blob: ef3fddab85db02bfd9d5c94d3d24eaee6c3aa419 [file] [log] [blame]
b.liu68a94c92025-05-24 12:53:41 +08001#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
18int 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}