parent
83c33a7c45
commit
e315cda76a
|
@ -4,9 +4,9 @@
|
|||
#include <stdbool.h>
|
||||
#include "user_group.h"
|
||||
|
||||
#define UNAMESIZE (64)
|
||||
#define UDESIZE (64)
|
||||
#define UPWDSIZE (64)
|
||||
#define UNAMESIZE (63)
|
||||
#define UDESIZE (63)
|
||||
#define UPWDSIZE (63)
|
||||
#define UTIME 20
|
||||
#define USER_ATTRIBUTE_NUM 8
|
||||
|
||||
|
@ -36,9 +36,9 @@ typedef struct user
|
|||
unsigned short ID; //用户id
|
||||
unsigned short GID; //用户组ID
|
||||
unsigned short multi_valid; //多人登陆、永久有效
|
||||
char uname[UNAMESIZE]; //用户名
|
||||
char passwd[UPWDSIZE]; //密码
|
||||
char udescription[UDESIZE]; //用户描述
|
||||
char uname[UNAMESIZE+1]; //用户名
|
||||
char passwd[UPWDSIZE+1]; //密码
|
||||
char udescription[UDESIZE+1]; //用户描述
|
||||
time_t valid_begin_time; //有效期开始时间
|
||||
time_t valid_end_time; //有效期结束时间
|
||||
}USERACCOUNT;
|
||||
|
@ -50,10 +50,10 @@ typedef struct userlist
|
|||
unsigned short multi;
|
||||
unsigned short valid;
|
||||
unsigned short resetpwd;
|
||||
char uname[UNAMESIZE];
|
||||
char gname[GNAMESIZE];
|
||||
char passwd[UPWDSIZE];
|
||||
char udescription[UDESIZE];
|
||||
char uname[UNAMESIZE+1];
|
||||
char gname[GNAMESIZE+1];
|
||||
char passwd[UPWDSIZE+1];
|
||||
char udescription[UDESIZE+1];
|
||||
char valid_begin_time[UTIME];
|
||||
char valid_end_time[UTIME];
|
||||
}USERLIST;
|
||||
|
@ -67,7 +67,7 @@ typedef struct result_user_add
|
|||
typedef union
|
||||
{
|
||||
unsigned short id;
|
||||
char uname[UNAMESIZE];
|
||||
char uname[UNAMESIZE+1];
|
||||
}USER_ID_NAME;
|
||||
|
||||
typedef struct
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
#include <stdbool.h>
|
||||
|
||||
#define GNAMESIZE (64)
|
||||
#define GDESIZE (64)
|
||||
#define GNAMESIZE (63)
|
||||
#define GDESIZE (63)
|
||||
|
||||
#define OFFLINE_USER_BY_GID "offuser_by_groupid_channel"
|
||||
#define USER_GROUP_DATABASE_ID 12
|
||||
|
@ -33,14 +33,14 @@
|
|||
typedef struct usergroup
|
||||
{
|
||||
unsigned short ID;
|
||||
char gname[GNAMESIZE];
|
||||
char gdescription[GDESIZE];
|
||||
char gname[GNAMESIZE+1];
|
||||
char gdescription[GDESIZE+1];
|
||||
}USERGROUP;
|
||||
|
||||
typedef union
|
||||
{
|
||||
unsigned short id;
|
||||
char gname[GNAMESIZE];
|
||||
char gname[GNAMESIZE+1];
|
||||
}GROUP_ID_NAME;
|
||||
|
||||
typedef struct
|
||||
|
|
|
@ -58,7 +58,7 @@ void usermanager_add_user(char* uname, char* gname, char* udesp, char* pwd, int
|
|||
}
|
||||
|
||||
/* 校验用户名和描述长度 */
|
||||
if ((UNAMESIZE) < strlen(uname) || 0 >= strlen(uname) || UDESIZE < strlen(udesp))
|
||||
if (UNAMESIZE < strlen(uname) || 0 >= strlen(uname) || UDESIZE < strlen(udesp))
|
||||
{
|
||||
uaddres->result = ADDUSER_FAIL_LENGTH;
|
||||
return;
|
||||
|
@ -104,7 +104,6 @@ void usermanager_add_user(char* uname, char* gname, char* udesp, char* pwd, int
|
|||
}
|
||||
|
||||
/* 连接数据库 */
|
||||
//adduser_hdbc = connect_database(USER_ACCOUNT_DATABASE_ID);
|
||||
re_connect();
|
||||
if(NULL == um_hdbc)
|
||||
{
|
||||
|
|
|
@ -29,11 +29,9 @@ int init_group()
|
|||
return INIT_SUCCESS;
|
||||
}
|
||||
|
||||
/* 添加元素 */
|
||||
/* 新增用户组 */
|
||||
int add_group(char* name, char* description)
|
||||
{
|
||||
//void *addgroup_hdbc;
|
||||
//int ret_release;
|
||||
if (NULL == name)
|
||||
{
|
||||
return ADDGROUP_ERROR;
|
||||
|
@ -58,7 +56,6 @@ int add_group(char* name, char* description)
|
|||
|
||||
/* 连接数据库 */
|
||||
re_connect();
|
||||
//addgroup_hdbc = connect_database(USER_GROUP_DATABASE_ID);
|
||||
if(NULL == um_hdbc)
|
||||
{
|
||||
/* 记录日志 */
|
||||
|
@ -105,17 +102,19 @@ int add_group(char* name, char* description)
|
|||
/* 修改用户组描述 */
|
||||
unsigned short mod_group_desp(int group_uuid, char* gdesp)
|
||||
{
|
||||
//void *modgroup_hdbc;
|
||||
//int ret_release;
|
||||
int num;
|
||||
if(NULL == gdesp)
|
||||
{
|
||||
gdesp = "";
|
||||
}
|
||||
|
||||
if(GDESIZE < strlen(gdesp))
|
||||
{
|
||||
return MODGROUP_FAIL_INPUT;
|
||||
}
|
||||
|
||||
/* 连接数据库 */
|
||||
re_connect();
|
||||
//modgroup_hdbc = connect_database(USER_GROUP_DATABASE_ID);
|
||||
if(NULL == um_hdbc)
|
||||
{
|
||||
/* 记录日志 */
|
||||
|
|
|
@ -13,17 +13,17 @@
|
|||
#define AUTH_INIT_SUCCESS 0
|
||||
#define AUTH_USER_INDEX_MAX (100 + 2)
|
||||
|
||||
#define UNAMESIZE (64)
|
||||
#define UDESIZE (64)
|
||||
#define UPWDSIZE (64)
|
||||
#define UNAMESIZE (63)
|
||||
#define UDESIZE (63)
|
||||
#define UPWDSIZE (63)
|
||||
|
||||
typedef struct user_auth
|
||||
{
|
||||
unsigned short ID; //用户id
|
||||
char uname[UNAMESIZE]; //用户名
|
||||
char udescription[UDESIZE]; //用户描述
|
||||
char uname[UNAMESIZE+1]; //用户名
|
||||
char udescription[UDESIZE+1]; //用户描述
|
||||
unsigned short GID; //用户组ID
|
||||
char passwd[UPWDSIZE]; //密码
|
||||
char passwd[UPWDSIZE+1]; //密码
|
||||
unsigned short multi_valid; //多人登陆、永久有效
|
||||
time_t valid_begin_time; //有效期开始时间
|
||||
time_t valid_end_time; //有效期结束时间
|
||||
|
|
|
@ -18,15 +18,6 @@
|
|||
extern USERGROUP g_group_table[GROUP_INDEX_MAX];
|
||||
extern USERACCOUNT g_user_table[USER_INDEX_MAX];
|
||||
|
||||
void test(int a, int b, int c, int d)
|
||||
{
|
||||
long long e;
|
||||
a = sizeof(long long);
|
||||
b = sizeof(long);
|
||||
d = 3;
|
||||
return;
|
||||
}
|
||||
|
||||
int main6(void)
|
||||
{
|
||||
char * testin; //input
|
||||
|
@ -79,8 +70,22 @@ int main6(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void test()
|
||||
{
|
||||
char *a = "和家亲";
|
||||
char *b = "asd";
|
||||
char *c = "123";
|
||||
printf("%ld .\n",strlen(a));
|
||||
printf("%ld .\n",strlen(b));
|
||||
printf("%ld .\n",strlen(c));
|
||||
return;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
||||
//test();
|
||||
|
||||
char * testrec;
|
||||
int testnum;
|
||||
userecover_config_get_all(CONFIG_FROM_RECOVER1,testrec, &testnum);
|
||||
|
@ -92,11 +97,10 @@ int main(void)
|
|||
int outlen = 1; //out数据长度
|
||||
|
||||
printf("\n************************************修改 group 描述*******************************************\n");
|
||||
testin = "{\"type\": 2,\"data\": {\"gid\": 1013,\"gdescription\": \"修改用户组的描述\"}}";
|
||||
testin = "{\"type\": 2,\"data\": {\"gid\": 1013,\"gdescription\": \"修改修改用户组的描述修改修改用户组的描述一二\"}}";
|
||||
ret_pro = usergroup_config_proc(1, 1, testin, strlen(testin)+1, testout, &outlen);
|
||||
printf("执行结果:%d, 返回数据:%s .\n", ret_pro, testout);
|
||||
|
||||
test(1,2,3,4);
|
||||
printf("\n************************************查询 user list*******************************************\n");
|
||||
testin = "{\"type\": 4,\"data\":{\"group_id\": 1014, \"user_name\": \"0\",\"page_start\": 1,\"page_counts\": 5}}";
|
||||
ret_pro = user_config_get(1, testin, strlen(testin)+1, testout, &outlen);
|
||||
|
|
|
@ -13,17 +13,17 @@
|
|||
#define AUTH_INIT_SUCCESS 0
|
||||
#define AUTH_USER_INDEX_MAX (100 + 2)
|
||||
|
||||
#define UNAMESIZE (64)
|
||||
#define UDESIZE (64)
|
||||
#define UPWDSIZE (64)
|
||||
#define UNAMESIZE (63)
|
||||
#define UDESIZE (63)
|
||||
#define UPWDSIZE (63)
|
||||
|
||||
typedef struct user_auth
|
||||
{
|
||||
unsigned short ID; //用户id
|
||||
char uname[UNAMESIZE]; //用户名
|
||||
char udescription[UDESIZE]; //用户描述
|
||||
char uname[UNAMESIZE+1]; //用户名
|
||||
char udescription[UDESIZE+1]; //用户描述
|
||||
unsigned short GID; //用户组ID
|
||||
char passwd[UPWDSIZE]; //密码
|
||||
char passwd[UPWDSIZE+1]; //密码
|
||||
unsigned short multi_valid; //多人登陆、永久有效
|
||||
time_t valid_begin_time; //有效期开始时间
|
||||
time_t valid_end_time; //有效期结束时间
|
||||
|
|
Loading…
Reference in New Issue