diff options
author | root <root@avtech.domain.avtechpulse.com> | 1999-12-31 19:20:29 -0500 |
---|---|---|
committer | root <root@avtech.domain.avtechpulse.com> | 1999-12-31 19:20:29 -0500 |
commit | 492e5c38fa1a5e42b4ad43c1daf119cfdedbc252 (patch) | |
tree | 4b8502a1db06885e45968db3f4406e73fb117164 /parser.c | |
parent | 74b9ff28228e3858ef4bc181a34a9acf9ca6be79 (diff) |
tidy up username/password code
Diffstat (limited to 'parser.c')
-rw-r--r-- | parser.c | 37 |
1 files changed, 35 insertions, 2 deletions
@@ -3613,8 +3613,41 @@ static int Go_puls_sep_89(gchar** response, int channel, char *parameter,char *u static int Go_sys_pwd_92(gchar** response, int channel, char *parameter,int command_type) { - // FIXME - needs /etc/shadow - return SyntaxError; + gchar *old_password = NULL; + gchar *new_password = NULL; + char *new_loc; + int error_num; + + switch (command_type) { + case command_withparam: + /* new password follows comma */ + + new_loc = strchr(parameter,','); + if (new_loc == NULL) { + return password_change_error; + } + + new_password = g_strdup_printf ("%s", new_loc + 1); + new_loc[0]=0; + old_password = g_strdup (parameter); + + error_num = OK; + if ((strlen(new_password)< 6) || (strlen(new_password)< 6)) { + error_num = password_change_error; + } + + if (!error_num) { + error_num = change_password (old_password, new_password); + } + + g_free (new_password); + g_free (old_password); + return error_num; + + default: + return SyntaxError; + break; + } } |