blob: 5892b012d559893b1123f83d02ca15a46b7b509f [file] [log] [blame]
lichengzhang4b22c342025-06-03 16:26:15 +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#include "gsw_hal_errcode.h"
14
15int32_t gsw_sec_set_loginpw(char *login_name, char *pw, unsigned int pw_len)
16{
17 int ret;
18 char cmd[256];
19 if((login_name == NULL) || (pw ==NULL))
20 {
21 return GSW_HAL_NORMAL_FAIL;
22 }
23 sprintf(cmd, "echo \"%s:%s\"|chpasswd", login_name, pw);
24 ret = system(cmd);
25 if (ret != 0 )
26 return GSW_HAL_NORMAL_FAIL;
27 else
28 return GSW_HAL_SUCCESS;
29}