blob: 4bc0779866f799edd840542de5a229637ed51f48 [file] [log] [blame]
b.liu68a94c92025-05-24 12:53:41 +08001#include <stdio.h>
2#include <string.h>
3#include <strings.h>
4#include <stdlib.h>
5#include <errno.h>
6#include <fcntl.h>
7#include <signal.h>
8#include <sys/types.h>
9#include <unistd.h>
10#include <pthread.h>
11#include <termios.h>
12#include <time.h>
13#include <sys/ioctl.h>
14#include <dlfcn.h>
15#include <stdint.h>
16#include <stdbool.h>
17
18
19int (*gsw_set_passwd)(char *username, char *passwd);
20void *dlHandle;
21char *lynqLib = "/lib/libgsw_lib.so";
22
23int main(int argc, char *argv[])
24{
25 int ret;
26 char tmp1[128];
27 char tmp2[128];
28 if(argc != 3)
29 {
30 printf("parameter error,please input username and passwd\n");
31 return -1;
32 }
33 strcpy(tmp1, argv[1]);
34 strcpy(tmp2, argv[2]);
35 printf("username is %s, passwd is %s\n",tmp1, tmp2);
36 dlHandle = dlopen(lynqLib, RTLD_NOW);
37 if(dlHandle == NULL)
38 {
39 printf("dlopen libgsw_lib fail\n");
40 return -1;
41 }
42 gsw_set_passwd=(int(*)(char *username, char *passwd))dlsym(dlHandle, "gsw_set_passwd");
43 if(dlHandle == NULL)
44 {
45 printf("dlsym gsw_set_passwd fail\n");
46 return -1;
47 }
48 ret = gsw_set_passwd(tmp1, tmp2);
49 if(ret)
50 {
51 printf("gsw_set_passwd fail\n");
52 }
53 else
54 {
55 printf("gsw_set_passwd successful\n");
56 }
57
58 return 0;
59}