diff options
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; + } } |