parent
704d436365
commit
584ce90ef4
|
@ -42,7 +42,7 @@ static ret_code user_config_add_proc(uint source, uint config_type,
|
|||
if(!data)
|
||||
{
|
||||
ret = RET_INPUTERR;
|
||||
ASSERT_RET(ret);
|
||||
//ASSERT_RET(ret);
|
||||
cJSON_Delete(root);
|
||||
return ret;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ static ret_code user_config_add_proc(uint source, uint config_type,
|
|||
if(!uname)
|
||||
{
|
||||
ret = RET_INPUTERR;
|
||||
ASSERT_RET(ret);
|
||||
// ASSERT_RET(ret);
|
||||
cJSON_Delete(root);
|
||||
return ret;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ static ret_code user_config_add_proc(uint source, uint config_type,
|
|||
if(!gname)
|
||||
{
|
||||
ret = RET_INPUTERR;
|
||||
ASSERT_RET(ret);
|
||||
// ASSERT_RET(ret);
|
||||
cJSON_Delete(root);
|
||||
return ret;
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ static ret_code user_config_add_proc(uint source, uint config_type,
|
|||
{
|
||||
// 记录日志
|
||||
ret = RET_ERR;
|
||||
ASSERT_RET(ret);
|
||||
//ASSERT_RET(ret);
|
||||
cJSON_Delete(root);
|
||||
return ret;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ static ret_code user_config_add_proc(uint source, uint config_type,
|
|||
if(!res)
|
||||
{
|
||||
ret = RET_ERR;
|
||||
ASSERT_RET(ret);
|
||||
// ASSERT_RET(ret);
|
||||
return ret;
|
||||
}
|
||||
cJSON_AddNumberToObject(res, "result", add_user_ret->result);
|
||||
|
@ -140,7 +140,7 @@ static ret_code user_config_mod_web_proc(uint source, uint config_type,
|
|||
if(!data)
|
||||
{
|
||||
ret = RET_INPUTERR;
|
||||
ASSERT_RET(ret);
|
||||
// ASSERT_RET(ret);
|
||||
cJSON_Delete(root);
|
||||
return ret;
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ static ret_code user_config_mod_web_proc(uint source, uint config_type,
|
|||
if(!ret_json)
|
||||
{
|
||||
ret = RET_ERR;
|
||||
ASSERT_RET(ret);
|
||||
//ASSERT_RET(ret);
|
||||
return ret;
|
||||
}
|
||||
cJSON_AddBoolToObject(ret_json, "result", ret_mod_web);
|
||||
|
@ -183,7 +183,7 @@ static ret_code user_config_mod_web_proc(uint source, uint config_type,
|
|||
* 修改用户-命令行-处理
|
||||
* iuput格式:
|
||||
* {
|
||||
* "type": 2,
|
||||
* "type": 5,
|
||||
* "data": {
|
||||
* "uname": "xxx",
|
||||
* "attr_type": 3,
|
||||
|
@ -212,7 +212,7 @@ static ret_code user_config_mod_line_proc(uint source, uint config_type,
|
|||
if(!data)
|
||||
{
|
||||
ret = RET_INPUTERR;
|
||||
ASSERT_RET(ret);
|
||||
//ASSERT_RET(ret);
|
||||
cJSON_Delete(root);
|
||||
return ret;
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ static ret_code user_config_mod_line_proc(uint source, uint config_type,
|
|||
if(!uname)
|
||||
{
|
||||
ret = RET_INPUTERR;
|
||||
ASSERT_RET(ret);
|
||||
//ASSERT_RET(ret);
|
||||
cJSON_Delete(root);
|
||||
return ret;
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ static ret_code user_config_mod_line_proc(uint source, uint config_type,
|
|||
if(!attr_type)
|
||||
{
|
||||
ret = RET_INPUTERR;
|
||||
ASSERT_RET(ret);
|
||||
//ASSERT_RET(ret);
|
||||
cJSON_Delete(root);
|
||||
return ret;
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ static ret_code user_config_mod_line_proc(uint source, uint config_type,
|
|||
if(!attr_data)
|
||||
{
|
||||
ret = RET_INPUTERR;
|
||||
ASSERT_RET(ret);
|
||||
//ASSERT_RET(ret);
|
||||
cJSON_Delete(root);
|
||||
return ret;
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ static ret_code user_config_mod_line_proc(uint source, uint config_type,
|
|||
if(!ret_json)
|
||||
{
|
||||
ret = RET_ERR;
|
||||
ASSERT_RET(ret);
|
||||
//ASSERT_RET(ret);
|
||||
return ret;
|
||||
}
|
||||
cJSON_AddBoolToObject(ret_json, "result", ret_mod_line);
|
||||
|
@ -273,12 +273,13 @@ ret_code user_config_proc(uint source, uint config_type,
|
|||
pointer output, int *output_len)
|
||||
{
|
||||
ret_code ret = RET_OK;
|
||||
cJSON *root, *type_json;
|
||||
int fun_type;
|
||||
|
||||
if(NULL == input)
|
||||
{
|
||||
ret = RET_INPUTERR;
|
||||
ASSERT_RET(ret);
|
||||
//ASSERT_RET(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -288,7 +289,7 @@ ret_code user_config_proc(uint source, uint config_type,
|
|||
if(ERR_FUNC_TYPE == fun_type)
|
||||
{
|
||||
ret = RET_INPUTERR;
|
||||
ASSERT_RET(ret);
|
||||
//ASSERT_RET(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -313,9 +314,9 @@ ret_code user_config_proc(uint source, uint config_type,
|
|||
ret = RET_NOTSUPPORT;
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret_code user_config_get(uint source,
|
||||
pointer input, int input_len,
|
||||
pointer output, int *output_len)
|
||||
|
|
|
@ -33,12 +33,13 @@ static ret_code usergroup_config_add_proc(uint source, uint config_type,
|
|||
char *des = NULL;
|
||||
char *ret_char = NULL;
|
||||
|
||||
/* 解析json串 */
|
||||
root = cJSON_Parse(input);
|
||||
data = cJSON_GetObjectItem(root, "data");
|
||||
if(!data)
|
||||
{
|
||||
ret = RET_INPUTERR;
|
||||
ASSERT_RET(ret);
|
||||
//ASSERT_RET(ret);
|
||||
cJSON_Delete(root);
|
||||
return ret;
|
||||
}
|
||||
|
@ -46,7 +47,7 @@ static ret_code usergroup_config_add_proc(uint source, uint config_type,
|
|||
if(!name)
|
||||
{
|
||||
ret = RET_INPUTERR;
|
||||
ASSERT_RET(ret);
|
||||
//ASSERT_RET(ret);
|
||||
cJSON_Delete(root);
|
||||
return ret;
|
||||
}
|
||||
|
@ -56,22 +57,24 @@ static ret_code usergroup_config_add_proc(uint source, uint config_type,
|
|||
des = description->valuestring;
|
||||
}
|
||||
|
||||
/* 执行操作 */
|
||||
result = add_group(name->valuestring, des); //增加用户组
|
||||
|
||||
/* 处理返回结果 */
|
||||
res = cJSON_CreateObject();
|
||||
if(!res)
|
||||
{
|
||||
ret = RET_ERR;
|
||||
ASSERT_RET(ret);
|
||||
//ASSERT_RET(ret);
|
||||
return ret;
|
||||
}
|
||||
cJSON_AddNumberToObject(res, "result", result);
|
||||
ret_char = cJSON_PrintUnformatted(res);
|
||||
memcpy(output, ret_char, strlen(ret_char)+1);
|
||||
|
||||
/* 释放内存 */
|
||||
cJSON_Delete(root);
|
||||
cJSON_Delete(res);
|
||||
UCHAR_FREE(des);
|
||||
UCHAR_FREE(ret_char);
|
||||
|
||||
return ret;
|
||||
|
@ -87,11 +90,12 @@ ret_code usergroup_config_proc(uint source, uint config_type,
|
|||
{
|
||||
ret_code ret = RET_OK;
|
||||
int fun_type;
|
||||
cJSON *root, *type_json;
|
||||
|
||||
if(NULL == input)
|
||||
{
|
||||
ret = RET_INPUTERR;
|
||||
ASSERT_RET(ret);
|
||||
//ASSERT_RET(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -101,7 +105,7 @@ ret_code usergroup_config_proc(uint source, uint config_type,
|
|||
if(ERR_FUNC_TYPE == fun_type)
|
||||
{
|
||||
ret = RET_INPUTERR;
|
||||
ASSERT_RET(ret);
|
||||
//ASSERT_RET(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,17 +29,20 @@ do { \
|
|||
#define VALID_GET(element) ((element) & VALID_MASK)
|
||||
#define VALID_SET(element, value) (((element) & MULTI_MASK) | ((value) & VALID_MASK))
|
||||
|
||||
#define FUNCTYPE_GET(input,fun_type) \
|
||||
do { \
|
||||
fun_type = -1; \
|
||||
cJSON *root, *type; \
|
||||
root = cJSON_Parse(input); \
|
||||
if(root) { \
|
||||
type = cJSON_GetObjectItem(root, "type"); \
|
||||
if(type) { \
|
||||
fun_type = type->valueint; \
|
||||
} \
|
||||
} \
|
||||
#define FUNCTYPE_GET(input,fun_type) \
|
||||
do { \
|
||||
fun_type = -1; \
|
||||
cJSON *def_root, *def_type; \
|
||||
def_root = cJSON_Parse(input); \
|
||||
if(def_root) { \
|
||||
def_type = cJSON_GetObjectItem(def_root, "type"); \
|
||||
if(def_type) { \
|
||||
fun_type = def_type->valueint; \
|
||||
cJSON_Delete(def_root); \
|
||||
}else{ \
|
||||
cJSON_Delete(def_root); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ERR_FUNC_TYPE -1
|
||||
|
|
|
@ -21,20 +21,21 @@ DEBUG = TRUE
|
|||
PLAT_LINUX ?= TRUE
|
||||
PLAT_ARM64 ?= FALSE
|
||||
|
||||
VPATH = ../user/user_manager/usermanager-test/ ../../Platform/user/configm/config-server/user_manager_config/usermanager-server/
|
||||
VPATH = ../user/user_manager/usermanager-test/ ../../Platform/user/configm/config-server/user_manager_config/
|
||||
|
||||
# source code
|
||||
|
||||
# set the source file, don't used .o because of ...
|
||||
|
||||
COMMON_SRCS = test_usermanager.c array_index.c user_group.c user_mod.c user.c
|
||||
COMMON_SRCS = test_usermanager.c user_account_config.c user_group_config.c usermanager-server/array_index.c usermanager-server/user_group.c usermanager-server/user_mod.c usermanager-server/user.c
|
||||
|
||||
# MRS Board Source Files
|
||||
PLAT_LINUX_SRCS = $(COMMON_SRCS)
|
||||
PLAT_ARM64_SRCS = $(COMMON_SRCS)
|
||||
|
||||
# gcc CFLAGS
|
||||
PLAT_ARM64_CFLAGS := -I../../Platform/user/configm/config-server/user_manager_config/usermanager-server/include -I../../Common -I../common
|
||||
PLAT_ARM64_CFLAGS := -I../../Platform/user/configm/config-server/user_manager_config -I../../Platform/user/configm/config-server/user_manager_config/usermanager-server/include -I../../Common -I../common \
|
||||
-I../../Platform/user/configm/config-server/include -I../../Platform/common/configm -I../../Platform/common/rpc -I../../Platform/common/rpc/hashtable
|
||||
PLAT_LINUX_CFLAGS := $(PLAT_ARM64_CFLAGS)
|
||||
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include "array_index.h"
|
||||
#include "user_group.h"
|
||||
#include "user.h"
|
||||
#include "user_account_config.h"
|
||||
#include "user_group_config.h"
|
||||
|
||||
|
||||
|
||||
|
@ -14,68 +16,111 @@
|
|||
extern USERGROUP g_group_table[GROUP_INDEX_MAX];
|
||||
extern USERACCOUNT g_user_table[USER_INDEX_MAX];
|
||||
|
||||
|
||||
int main1()
|
||||
int main1(void)
|
||||
{
|
||||
int a[2] = {1,2};
|
||||
printf("%d", sizeof(a)/sizeof(a[0]));
|
||||
printf("初始化用户组:%d\n", init_group());
|
||||
|
||||
printf("增加一个用户组:%d\n", add_group("aaa04", "描述04"));
|
||||
printf("增加一个用户组:%d\n", add_group("aaa07", "描述04"));
|
||||
printf("增加一个用户组:%d\n", add_group("aaa08", "描述04"));
|
||||
printf("增加一个用户组:%d\n", add_group("aaa09", "描述04"));
|
||||
printf("增加一个用户组:%d\n", add_group("aaa10", "描述04"));
|
||||
printf("增加一个用户组:%d\n", add_group("aaa11", "描述04"));
|
||||
printf("增加一个用户组:%d\n", add_group("aaa12", "描述04"));
|
||||
char *testgroupin = "{\"type\": 0,\"data\": {\"gname\": \"aaa21\",\"gdescription\": \"xxx\"}}";
|
||||
char *testgroupin01 = "{\"type\": 0,\"data\": {\"gname\": \"aaa22\",\"gdescription\": \"xxx\"}}";
|
||||
char * outputgroup;
|
||||
char * outputgroup01;
|
||||
outputgroup = malloc(130);
|
||||
outputgroup01 = malloc(130);
|
||||
if (NULL == outputgroup || NULL == outputgroup01)
|
||||
{
|
||||
printf("ulist fail");
|
||||
}
|
||||
int *olenth = 1;
|
||||
ret_code ret_add_group = usergroup_config_proc(1,1,testgroupin,1,outputgroup,olenth);
|
||||
printf("测试对外接口-增加一个用户组:%d\n", ret_add_group);
|
||||
printf("%s \n", outputgroup);
|
||||
|
||||
ret_code ret_add_group01 = usergroup_config_proc(1,1,testgroupin01,1,outputgroup01,olenth);
|
||||
printf("测试对外接口-增加一个用户组:%d\n", ret_add_group01);
|
||||
printf("%s \n", outputgroup01);
|
||||
|
||||
|
||||
|
||||
|
||||
printf("初始化用户:%d\n", init_user());
|
||||
|
||||
USERADD* addUserResullt;
|
||||
addUserResullt = (USERADD*)malloc(sizeof(USERADD));
|
||||
if (NULL == addUserResullt)
|
||||
{
|
||||
printf("shibaile");
|
||||
}
|
||||
|
||||
usermanager_add_user("用户01", "aaa08", addUserResullt);
|
||||
printf("%d,用户id:%d\n", addUserResullt->result, addUserResullt->userID);
|
||||
usermanager_add_user("用户02", "aaa04", addUserResullt);
|
||||
printf("%d,用户id:%d\n", addUserResullt->result, addUserResullt->userID);
|
||||
usermanager_add_user("用户03", "aaa04", addUserResullt);
|
||||
printf("%d,用户id:%d\n", addUserResullt->result, addUserResullt->userID);
|
||||
usermanager_add_user("用户04", "aaa04", addUserResullt);
|
||||
printf("%d,用户id:%d\n", addUserResullt->result, addUserResullt->userID);
|
||||
usermanager_add_user("用户05", "aaa04", addUserResullt);
|
||||
printf("%d,用户id:%d\n", addUserResullt->result, addUserResullt->userID);
|
||||
|
||||
char * output1;
|
||||
output1 = malloc(50);
|
||||
if (NULL == output1)
|
||||
{
|
||||
printf("ulist fail");
|
||||
}
|
||||
|
||||
char *testin = "{\"type\": 0,\"data\": {\"uname\": \"小明\",\"gname\": \"aaa08\"}}";
|
||||
int *a = 1;
|
||||
ret_code c = user_config_proc(1, 1, testin, 1, output1, a);
|
||||
|
||||
printf("*******************************************************************************\n");
|
||||
printf("这里是个测试第一次结果,新增用户:%d\n", c);
|
||||
printf("%s\n", output1);
|
||||
printf("*******************************************************************************\n");
|
||||
|
||||
|
||||
char *testmodweb = "{\"type\":2, \"data\":{\"ID\": 2,\"GID\" : 4,\"uname\" : \"用户05\",\"gname\" : \"xxx\",\"passwd\" : \"zhelishimima123\" , \
|
||||
\"udescription\" : \"修改用\",\"multi\" : 1,\"valid\" : 1,\"valid_begin_time\" : \"2013-07-04 15:04:23\",\"valid_end_time\" : \"2019-07-04 15:04:23\"}}";
|
||||
|
||||
char * output2;
|
||||
output2 = malloc(50);
|
||||
if (NULL == output2)
|
||||
{
|
||||
printf("ulist fail");
|
||||
}
|
||||
ret_code cc = user_config_proc(1, 1, testmodweb, 1, output2, a);
|
||||
printf("*******************************************************************************\n");
|
||||
printf("这里是个测试第二次结果,修改用户web:%d\n", cc);
|
||||
printf("%s\n", output2);
|
||||
printf("*******************************************************************************\n");
|
||||
UCHAR_FREE(output2);
|
||||
|
||||
char *testmodline = "{\"type\":5, \"data\":{\"uname\": \"用户05\",\"attr_type\" : 6,\"attr_data\" : \"2018-03-03 15:04:23\"}}";
|
||||
char * output3;
|
||||
output3 = malloc(50);
|
||||
if (NULL == output3)
|
||||
{
|
||||
printf("ulist fail");
|
||||
}
|
||||
ret_code ccc = user_config_proc(1, 1, testmodline, 1, output3, a);
|
||||
printf("*******************************************************************************\n");
|
||||
printf("这里是个测试第三次结果,修改用户-line:%d\n", ccc);
|
||||
printf("%s\n", output3);
|
||||
printf("*******************************************************************************\n");
|
||||
UCHAR_FREE(output3);
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int usergroup_config_add_proc(int source, int config_type,
|
||||
void* input, int input_len,
|
||||
void* output, int *output_len)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned short result;
|
||||
cJSON *root, *data, *name, *description, *res;
|
||||
char *des = NULL;
|
||||
char *ret_char = NULL;
|
||||
|
||||
root = cJSON_Parse(input);
|
||||
data = cJSON_GetObjectItem(root, "data");
|
||||
if(!data)
|
||||
{
|
||||
ret = -1;
|
||||
//ASSERT_RET(ret);
|
||||
cJSON_Delete(root);
|
||||
return ret;
|
||||
}
|
||||
|
||||
name = cJSON_GetObjectItem(data, "gname");
|
||||
if(!name)
|
||||
{
|
||||
ret = -1;
|
||||
//ASSERT_RET(ret);
|
||||
cJSON_Delete(root);
|
||||
return ret;
|
||||
}
|
||||
|
||||
description = cJSON_GetObjectItem(data, "gdescription");
|
||||
if(description)
|
||||
{
|
||||
des = description->valuestring;
|
||||
}
|
||||
|
||||
result = add_group(name->valuestring, des); //增加用户组
|
||||
cJSON_Delete(root);
|
||||
|
||||
res = cJSON_CreateObject();
|
||||
if(!res)
|
||||
{
|
||||
ret = -1;
|
||||
//ASSERT_RET(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
cJSON_AddNumberToObject(res, "result", result);
|
||||
ret_char = cJSON_PrintUnformatted(res);
|
||||
memcpy(output, ret_char, strlen(ret_char)+1);
|
||||
cJSON_Delete(res);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
@ -95,17 +140,6 @@ int main(void)
|
|||
printf("增加一个用户组:%d\n", add_group("aaa11", "描述04"));
|
||||
printf("增加一个用户组:%d\n", add_group("aaa12", "描述04"));
|
||||
|
||||
char *out_put;
|
||||
out_put = malloc(sizeof(char) * 200);
|
||||
if (NULL == out_put)
|
||||
{
|
||||
printf("*****\n");
|
||||
}
|
||||
char* input = "{\"type\": 0,\"data\": {\"gname\": \"xxx\",\"gdescription\": \"xxx\"}}";
|
||||
|
||||
printf("ttttt增加一个用户组:%d\n", usergroup_config_add_proc(1, 1, input, 100, out_put, 200));
|
||||
printf("result: %s", out_put);
|
||||
|
||||
//USERGROUP U[22] = { 0 };
|
||||
int gsize = get_group_count();
|
||||
|
||||
|
@ -138,7 +172,21 @@ int main(void)
|
|||
printf("增加一个用户组:%d\n", add_group("aaa18", "描述04"));
|
||||
printf("增加一个用户组:%d\n", add_group("aaa18", "描述04"));
|
||||
printf("增加一个用户组:%d\n", add_group("aaa20", "描述04"));
|
||||
printf("增加一个用户组:%d\n", add_group("aaa21", "描述04"));
|
||||
//printf("增加一个用户组:%d\n", add_group("aaa21", "描述04"));
|
||||
|
||||
char *testgroupin = "{\"type\": 0,\"data\": {\"gname\": \"aaa21\",\"gdescription\": \"xxx\"}}";
|
||||
char * outputgroup;
|
||||
outputgroup = malloc(130);
|
||||
if (NULL == outputgroup)
|
||||
{
|
||||
printf("ulist fail");
|
||||
}
|
||||
int *olenth = 1;
|
||||
ret_code ret_add_group = usergroup_config_proc(1,1,testgroupin,1,outputgroup,olenth);
|
||||
printf("测试对外接口-增加一个用户组:%d\n", ret_add_group);
|
||||
printf("%s \n", outputgroup);
|
||||
UCHAR_FREE(outputgroup);
|
||||
|
||||
printf("增加一个用户组:%d\n", add_group("aaa22", "描述04"));
|
||||
printf("增加一个用户组:%d\n", add_group("aaa23", "描述04"));
|
||||
printf("增加一个用户组:%d\n", add_group("aaa20", "描述04"));
|
||||
|
@ -190,6 +238,7 @@ int main(void)
|
|||
|
||||
USERADD* addUserResullt;
|
||||
addUserResullt = (USERADD*)malloc(sizeof(USERADD));
|
||||
//printf("sizeof(USERADD): %d\n",sizeof(USERADD));
|
||||
if (NULL == addUserResullt)
|
||||
{
|
||||
printf("shibaile");
|
||||
|
@ -222,6 +271,25 @@ int main(void)
|
|||
usermanager_add_user("用户09", "aaa07", addUserResullt);
|
||||
printf("%d,%d\n", addUserResullt->result, addUserResullt->userID);
|
||||
|
||||
|
||||
|
||||
char * output1;
|
||||
output1 = malloc(40);
|
||||
if (NULL == output1)
|
||||
{
|
||||
printf("ulist fail");
|
||||
}
|
||||
|
||||
char *testin = "{\"type\": 0,\"data\": {\"uname\": \"小明\",\"gname\": \"aaa14\"}}";
|
||||
int *a = 1;
|
||||
ret_code c = user_config_proc(1, 1, testin, 1, output1, a);
|
||||
|
||||
printf("*******************************************************************************\n");
|
||||
printf("这里是个测试第一次结果,新增用户:%d\n", c);
|
||||
printf("%s\n", output1);
|
||||
printf("*******************************************************************************\n");
|
||||
UCHAR_FREE(output1);
|
||||
|
||||
for (int i = 0; i < USER_INDEX_MAX; i++)
|
||||
{
|
||||
if (g_user_table[i].ID != 0)
|
||||
|
@ -245,24 +313,40 @@ int main(void)
|
|||
printf(" ,多用户登陆:%d, 永久性:%d, 开始时间:%s, 结束时间:%s", ulist->multi, ulist->valid, ulist->valid_begin_time, ulist->valid_end_time);
|
||||
printf("密码:%s\n", ulist->passwd);
|
||||
|
||||
USERLIST* ulist2;
|
||||
ulist2 = (USERLIST*)malloc(sizeof(USERLIST));
|
||||
if (NULL == ulist2)
|
||||
// USERLIST* ulist2;
|
||||
// ulist2 = (USERLIST*)malloc(sizeof(USERLIST));
|
||||
// if (NULL == ulist2)
|
||||
// {
|
||||
// printf("ulist fail");
|
||||
// }
|
||||
|
||||
// ulist2->ID = 2;
|
||||
// ulist2->GID = 4;
|
||||
// strcpy(ulist2->udescription, "修改用");
|
||||
// strcpy(ulist2->passwd, "zhelishimima123");
|
||||
// ulist2->multi = 1;
|
||||
// ulist2->valid = 1;
|
||||
// strcpy(ulist2->valid_begin_time, "2013-07-04 15:04:23");
|
||||
// strcpy(ulist2->valid_end_time, "2019-07-04 15:04:23");
|
||||
|
||||
|
||||
// printf("%d\n", mod_user_web(ulist2));
|
||||
|
||||
char *testmodweb = "{\"type\":2, \"data\":{\"ID\": 2,\"GID\" : 4,\"uname\" : \"用户05\",\"gname\" : \"xxx\",\"passwd\" : \"zhelishimima123\" , \
|
||||
\"udescription\" : \"修改用\",\"multi\" : 1,\"valid\" : 1,\"valid_begin_time\" : \"2013-07-04 15:04:23\",\"valid_end_time\" : \"2019-07-04 15:04:23\"}}";
|
||||
|
||||
char * output2;
|
||||
output2 = malloc(50);
|
||||
if (NULL == output2)
|
||||
{
|
||||
printf("ulist fail");
|
||||
}
|
||||
|
||||
ulist2->ID = 2;
|
||||
ulist2->GID = 4;
|
||||
strcpy(ulist2->udescription, "修改用");
|
||||
strcpy(ulist2->passwd, "zhelishimima123");
|
||||
ulist2->multi = 1;
|
||||
ulist2->valid = 1;
|
||||
strcpy(ulist2->valid_begin_time, "2013-07-04 15:04:23");
|
||||
strcpy(ulist2->valid_end_time, "2019-07-04 15:04:23");
|
||||
|
||||
|
||||
printf("%d\n", mod_user_web(ulist2));
|
||||
ret_code cc = user_config_proc(1, 1, testmodweb, 1, output2, a);
|
||||
printf("*******************************************************************************\n");
|
||||
printf("这里是个测试第二次结果,修改用户web:%d\n", cc);
|
||||
printf("%s\n", output2);
|
||||
printf("*******************************************************************************\n");
|
||||
UCHAR_FREE(output2);
|
||||
|
||||
USERLIST* ulist22;
|
||||
ulist22 = (USERLIST*)malloc(sizeof(USERLIST));
|
||||
|
@ -284,8 +368,22 @@ int main(void)
|
|||
//mod_user_line("用户05", 3, "1");
|
||||
mod_user_line("用户05", 4, "1");
|
||||
mod_user_line("用户05", 5, "2013-03-03 15:04:23");
|
||||
mod_user_line("用户05", 6, "2018-03-03 15:04:23");
|
||||
//mod_user_line("用户05", 6, "2018-03-03 15:04:23");
|
||||
//mod_user_line("用户05", 7, "2020-03-03 15:04:23");
|
||||
char *testmodline = "{\"type\":5, \"data\":{\"uname\": \"用户05\",\"attr_type\" : 6,\"attr_data\" : \"2018-03-03 15:04:23\"}}";
|
||||
|
||||
char * output3;
|
||||
output3 = malloc(50);
|
||||
if (NULL == output3)
|
||||
{
|
||||
printf("ulist fail");
|
||||
}
|
||||
ret_code ccc = user_config_proc(1, 1, testmodline, 1, output3, a);
|
||||
printf("*******************************************************************************\n");
|
||||
printf("这里是个测试第三次结果,修改用户-line:%d\n", ccc);
|
||||
printf("%s\n", output3);
|
||||
printf("*******************************************************************************\n");
|
||||
UCHAR_FREE(output3);
|
||||
|
||||
unsigned short id2 = 3;
|
||||
get_user_by_id(id2, ulist22);
|
||||
|
|
Loading…
Reference in New Issue