summaryrefslogtreecommitdiff
path: root/parser.c
diff options
context:
space:
mode:
authorroot <root@avtech.domain.avtechpulse.com>1999-12-31 19:20:29 -0500
committerroot <root@avtech.domain.avtechpulse.com>1999-12-31 19:20:29 -0500
commit492e5c38fa1a5e42b4ad43c1daf119cfdedbc252 (patch)
tree4b8502a1db06885e45968db3f4406e73fb117164 /parser.c
parent74b9ff28228e3858ef4bc181a34a9acf9ca6be79 (diff)
tidy up username/password code
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/parser.c b/parser.c
index c125d2b..c5b0886 100644
--- a/parser.c
+++ b/parser.c
@@ -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;
+ }
}