blob: 4bc0779866f799edd840542de5a229637ed51f48 [file] [log] [blame]
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/types.h>
#include <unistd.h>
#include <pthread.h>
#include <termios.h>
#include <time.h>
#include <sys/ioctl.h>
#include <dlfcn.h>
#include <stdint.h>
#include <stdbool.h>
int (*gsw_set_passwd)(char *username, char *passwd);
void *dlHandle;
char *lynqLib = "/lib/libgsw_lib.so";
int main(int argc, char *argv[])
{
int ret;
char tmp1[128];
char tmp2[128];
if(argc != 3)
{
printf("parameter error,please input username and passwd\n");
return -1;
}
strcpy(tmp1, argv[1]);
strcpy(tmp2, argv[2]);
printf("username is %s, passwd is %s\n",tmp1, tmp2);
dlHandle = dlopen(lynqLib, RTLD_NOW);
if(dlHandle == NULL)
{
printf("dlopen libgsw_lib fail\n");
return -1;
}
gsw_set_passwd=(int(*)(char *username, char *passwd))dlsym(dlHandle, "gsw_set_passwd");
if(dlHandle == NULL)
{
printf("dlsym gsw_set_passwd fail\n");
return -1;
}
ret = gsw_set_passwd(tmp1, tmp2);
if(ret)
{
printf("gsw_set_passwd fail\n");
}
else
{
printf("gsw_set_passwd successful\n");
}
return 0;
}