2 * (c) 2009-2012 by Art Cancro and citadel.org
3 * This program is released under the terms of the GNU General Public License v3.
8 int cmd_passwd(int server_socket, char *cmdbuf)
12 char account_name[1024];
16 strcpy(account_name, &cmdbuf[7]);
17 if (strlen(account_name) == 0) {
18 strncpy(account_name, readline("Enter account name: "), sizeof account_name);
20 sock_printf(server_socket, "AGUP %s\n", account_name);
21 sock_getln(server_socket, buf, sizeof buf);
23 fprintf(stderr, "No such user.\n");
24 return (cmdret_error);
27 p1 = readline("Enter new password: ");
28 p2 = readline("Enter it again: ");
31 fprintf(stderr, "The passwords you entered do not match." "The account password remains unchanged.\n");
32 return (cmdret_error);
35 sock_printf(server_socket, "ASUP %s|%s\n", account_name, p2);
36 sock_getln(server_socket, buf, sizeof buf);
38 fprintf(stderr, "%s\n", &buf[4]);
39 return (cmdret_error);
42 printf("Password has been changed.\n");