| #include <stdio.h> |
| #include <stdlib.h> |
| #include <fcntl.h> |
| #include <sys/types.h> |
| #include <sys/stat.h> |
| #include <string.h> |
| #include <errno.h> |
| #include <termios.h> |
| #include <unistd.h> |
| #include <stdint.h> |
| #include <sys/ioctl.h> |
| #include <dlfcn.h> |
| #include "gsw_hal_errcode.h" |
| |
| int32_t gsw_sec_set_loginpw(char *login_name, char *pw, unsigned int pw_len) |
| { |
| int ret; |
| char cmd[256]; |
| if((login_name == NULL) || (pw == NULL) || (strlen(pw) != pw_len)) |
| { |
| return GSW_HAL_NORMAL_FAIL; |
| } |
| sprintf(cmd, "echo \"%s:%s\"|chpasswd", login_name, pw); |
| ret = system(cmd); |
| if (ret != 0 ) |
| return GSW_HAL_NORMAL_FAIL; |
| else |
| return GSW_HAL_SUCCESS; |
| } |