b.liu | 68a94c9 | 2025-05-24 12:53:41 +0800 | [diff] [blame^] | 1 | #include <stdio.h> |
2 | #include <stdlib.h> | ||||
3 | #include <fcntl.h> | ||||
4 | #include <sys/types.h> | ||||
5 | #include <sys/stat.h> | ||||
6 | #include <string.h> | ||||
7 | #include <errno.h> | ||||
8 | #include <termios.h> | ||||
9 | #include <unistd.h> | ||||
10 | #include <stdint.h> | ||||
11 | #include <sys/ioctl.h> | ||||
12 | #include <dlfcn.h> | ||||
13 | |||||
14 | |||||
15 | #include "gsw_passwd.h" | ||||
16 | |||||
17 | |||||
18 | int gsw_set_passwd(char *username, char *passwd) | ||||
19 | { | ||||
20 | int ret; | ||||
21 | char cmd[256]; | ||||
22 | if((username == NULL) || (passwd ==NULL)) | ||||
23 | { | ||||
24 | return -1; | ||||
25 | } | ||||
26 | sprintf(cmd, "echo \"%s:%s\"|chpasswd", username, passwd); | ||||
27 | ret = system(cmd); | ||||
28 | return ret; | ||||
29 | } |