DDadmin.c
18.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
/*
*-------------------- DD_ADMIN -------------------------------
* V.1.1
*/
/* name: DDadmin.c
* author: Alexandr Grigoriev
* Insitution: IKI RAN lab.546 aug@afed.iki.rssi.ru
* date : March 1999
* sinopsis:
*
* usage:
*
* Description: Program is to adding users into DD access list.
* Nov 30 2009 - V.1.1 - netCDF-3
Nov 08 2011 -
*/
#define _XOPEN_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <unistd.h>
#include <time.h>
#include <DD.h>
#include <netcdf.h>
#include <DD_Access.h>
#define FILE_PATH_LEN 1024
#define LOGIN_MIN_LEN 2
#define LOGIN_MAX_LEN 20
#define PWD_HASHED_LEN 13
#define PWD_MIN_LEN 5
#define PWD_MAX_LEN 80
#define PWD_GEN_SIZE 6
#define NC_USER_NAME "user"
#define NC_USER_LEN_NAME "UserLength"
#define NC_PWD_LEN_NAME "PasswdLength"
#define NC_MEMBER_NAME "member"
#define NC_PWD_NAME "passwd"
#define ERR_BAD_REQUEST 1
#define ERR_DDBASE_UNDEFINED 2
#define ERR_FILE_UNREACHABLE 3
#define ERR_FILE_BAD_INFO 4
#define ERR_MANUAL_ABORTED 5
#define ERR_REQUEST_FAILED 6
typedef enum {OP_ADD_MANUAL,
OP_ADD_AUTO,
OP_MODIFY,
OP_DELETE,
OP_RESET,
OP_GET_SALT,
OP_GET_LIST
} t_Op;
typedef struct {
t_Op op;
char login[LOGIN_MAX_LEN+1];
char pwd_hash[PWD_HASHED_LEN+1];
char pwd_hash_new[PWD_HASHED_LEN+1];
} t_Request;
typedef struct {
int ncID;
int UserID;
int UserLenID;
int PwdLenID;
int MemberID;
int PwdID;
long MaxRecords;
long UserLen;
long PwdLen;
} t_UserFileInfo;
//---------------------------------------------------------------------------
void Usage(void)
{
printf("DDadmin [-option] [login] [pwd_hash] [pwd_hash_new]\n");
printf(" * without arguments: add new user manually\n");
printf(" * -option :\n");
printf(" -a : add new user [login] with the hashed password [pwd_hash]\n");
printf(" -m : modify the password of user [login]. [pwd_hash] is checked, and replace by [pwd_hash_new]\n");
printf(" -r : reset the password of user [login]. A new one is generated\n");
printf(" -d : delete the user [login]\n");
printf(" -s : return salt used to crypt the password of user [login]\n");
printf(" -l : return a list of users\n");
printf(" -h : this help\n");
}
//---------------------------------------------------------------------------
unsigned char GetRandomChar(void)
{
return (unsigned char)(rand()%26+'a');
}
//--------------------------------------------------------------------------
int TestLogin(char *login)
{
int j = strlen(login);
if(j<LOGIN_MIN_LEN)
{
printf("login is too short.\n");
return 0;
}
if(j>LOGIN_MAX_LEN)
{
printf("login is too long.\n");
return 0;
}
return 1;
}
//-------------------------------------------------------------------------
int GetLogin(char *login)
{
printf("login:");
char l = '\0';
int j = 0;
while((l!='\n'))
{
l=getchar();
if(j < LOGIN_MAX_LEN)
login[j] = l;
j++;
}
login[j-1] = '\0';
if (!TestLogin(login))
return 0;
return 1;
}
//--------------------------------------------------------------------
int TestPwd(char *pwd)
{
int j = strlen(pwd);
if(j < PWD_MIN_LEN)
{
printf("Password is too short.\n");
return 0;
}
if(j > PWD_MAX_LEN)
{
printf("Password is too long.\n");
return 0;
}
return 1;
}
//--------------------------------------------------------------------
int GetNewPwd(char *pwd)
{
char pas1[PWD_MAX_LEN+1];
char pas2[PWD_MAX_LEN+1];
int isFinish = 0;
while (!isFinish)
{
strcpy(pas1,getpass("New password:"));
pas1[strlen(pas1)] = '\0';
isFinish = TestPwd(pas1);
}
strcpy(pas2,getpass("Retype new password:"));
pas2[strlen(pas2)] = '\0';
int ok = (strcmp(pas1,pas2) == 0);
if (ok)
strcpy(pwd,pas1);
memset(pas1,0,(PWD_MAX_LEN+1)*sizeof(char));
memset(pas2,0,(PWD_MAX_LEN+1)*sizeof(char));
if (!ok)
{
printf("Error - Passwords mismatch\n");
return 0;
}
return 1;
}
//--------------------------------------------------------------------
int GeneratePwd(char *pwd)
{
int i = 0;
for (i = 0; i < PWD_GEN_SIZE; i++)
pwd[i] = GetRandomChar();
return 1;
}
//--------------------------------------------------------------------
int GetRequest(int argc, char *argv[], t_Request *request)
{
memset(request,0,sizeof(t_Request));
if (argc < 2)
{
request->op = OP_ADD_MANUAL;
return 1;
}
if ((strlen(argv[1]) != 2) || (argv[1][0] != '-'))
{
printf("Error - Bad option\n");
Usage();
return 0;
}
//option
switch (argv[1][1])
{
case 'a' :
request->op = OP_ADD_AUTO;
break;
case 'm' :
request->op = OP_MODIFY;
break;
case 'd' :
request->op = OP_DELETE;
break;
case 'r' :
request->op = OP_RESET;
break;
case 'h' :
Usage();
return 0;
case 's' :
request->op = OP_GET_SALT;
break;
case 'l' :
request->op = OP_GET_LIST;
return 1;
default :
printf("Error - Bad option\n");
Usage();
return 0;
}
//login
if (argc < 3)
{
printf("Error - Cannot get login\n");
Usage();
return 0;
}
if (!TestLogin(argv[2]))
{
Usage();
return 0;
}
strcpy(request->login, argv[2]);
if ((request->op == OP_ADD_AUTO) || (request->op == OP_MODIFY))
{
//password hash code
if (argc < 4)
{
printf("Error - Cannot get password hash code\n");
Usage();
return 0;
}
if (strlen(argv[3]) != PWD_HASHED_LEN)
{
printf("Error - Incorrect password hash code\n");
Usage();
return 0;
}
strcpy(request->pwd_hash, argv[3]);
if (request->op == OP_MODIFY)
{
//new password hash code
if (argc < 5)
{
printf("Error - Cannot get new password hash code\n");
Usage();
return 0;
}
if (strlen(argv[4]) != PWD_HASHED_LEN)
{
printf("Error - Incorrect new password hash code\n");
Usage();
return 0;
}
strcpy(request->pwd_hash_new, argv[4]);
}
}
return 1;
}
//--------------------------------------------------------------------------
int GetUserFilePath(char *path)
{
path[0]='\0';
char *ddbase;
if((ddbase = getenv("DDBASE")) == NULL)
{
printf("No DDBASE info \n");
return 0;
}
strcpy(path,ddbase);
strcat(path,USERREFNAME);
return 1;
}
//--------------------------------------------------------------------------
int OpenUserFile(char *path, t_UserFileInfo *fileInfo)
{
int status;
if((status = nc_open(path, NC_WRITE, &fileInfo->ncID)) != NC_NOERR)
{
printf("Error in opening file = %u\n", fileInfo->ncID);
return 0;
}
return 1;
}
//--------------------------------------------------------------------------
int CloseUserFile(t_UserFileInfo *fileInfo)
{
nc_close(fileInfo->ncID);
memset(fileInfo,0,sizeof(t_UserFileInfo));
return 1;
}
//---------------------------------------------------------------------------
int GetFileInfo(t_UserFileInfo *fileInfo)
{
int status;
if (((status = nc_inq_unlimdim(fileInfo->ncID, (int *)&fileInfo->UserID)) != NC_NOERR) ||
((status = nc_inq_dimlen(fileInfo->ncID, fileInfo->UserID, (size_t *)&fileInfo->MaxRecords)) != NC_NOERR) ||
((status = nc_inq_dimid(fileInfo->ncID, NC_USER_LEN_NAME, &fileInfo->UserLenID)) != NC_NOERR) ||
((status = nc_inq_dimid(fileInfo->ncID, NC_PWD_LEN_NAME, &fileInfo->PwdLenID)) != NC_NOERR) ||
((status = nc_inq_dimlen(fileInfo->ncID, fileInfo->UserLenID, (size_t *)&fileInfo->UserLen)) != NC_NOERR) ||
((status = nc_inq_dimlen(fileInfo->ncID, fileInfo->PwdLenID, (size_t *)&fileInfo->PwdLen)) != NC_NOERR) ||
((status = nc_inq_varid(fileInfo->ncID, NC_MEMBER_NAME, &fileInfo->MemberID)) != NC_NOERR) ||
((status = nc_inq_varid(fileInfo->ncID, NC_PWD_NAME, &fileInfo->PwdID)) != NC_NOERR))
{
printf("Error - Cannot get file information\n");
return 0;
}
fileInfo->UserLen = LOGIN_MAX_LEN;
fileInfo->PwdLen = PWD_HASHED_LEN;
return 1;
}
//--------------------------------------------------------------------------
int CreateUserFile(char *filePath, t_UserFileInfo *fileInfo)
{
int status;
fileInfo->UserLen = LOGIN_MAX_LEN;
fileInfo->PwdLen = PWD_HASHED_LEN;
if (((status = nc_create (filePath,NC_SHARE,&fileInfo->ncID)) != NC_NOERR) ||
((status = nc_def_dim (fileInfo->ncID, NC_USER_NAME, NC_UNLIMITED, &fileInfo->UserID)) != NC_NOERR) ||
((status = nc_def_dim (fileInfo->ncID, NC_USER_LEN_NAME, fileInfo->UserLen+1, &fileInfo->UserLenID)) != NC_NOERR) ||
((status = nc_def_dim (fileInfo->ncID, NC_PWD_LEN_NAME, fileInfo->PwdLen+1, &fileInfo->PwdLenID)) != NC_NOERR))
{
printf("Error - Cannot create users file\n");
return 0;
}
int MemberDimVector[2] = {fileInfo->UserID,fileInfo->UserLenID};
int PwdDimVector[2] = {fileInfo->UserID,fileInfo->PwdLenID};
if (((status = nc_def_var (fileInfo->ncID, NC_MEMBER_NAME,NC_CHAR,2, MemberDimVector,&fileInfo->MemberID)) != NC_NOERR) ||
((status = nc_def_var (fileInfo->ncID, NC_PWD_NAME, NC_CHAR, 2, PwdDimVector, &fileInfo->PwdID)) != NC_NOERR))
{
printf("Error - Cannot create users file\n");
return 0;
}
nc_enddef(fileInfo->ncID);
return 1;
}
//--------------------------------------------------------------------------
int CleanUserFile(void)
{
t_UserFileInfo fileInfo, tmpFileInfo;
memset(&fileInfo,0,sizeof(t_UserFileInfo));
memset(&tmpFileInfo,0,sizeof(t_UserFileInfo));
char refname[FILE_PATH_LEN], tmpname[FILE_PATH_LEN];
if (!GetUserFilePath(refname))
return 0;
strcpy(tmpname,refname);
strcat(tmpname,".tmp");
if (!OpenUserFile(refname,&fileInfo))
return 0;
if (!GetFileInfo(&fileInfo))
return 0;
if (!CreateUserFile(tmpname,&tmpFileInfo))
return 0;
int i;
int c = 0;
char crtLogin[LOGIN_MAX_LEN+1];
char crtPwd[PWD_MAX_LEN+1];
for(i = 0; i < fileInfo.MaxRecords; i++)
{
if (!GetLoginFromIndex(i,&fileInfo,crtLogin) || !GetPwdFromIndex(i,&fileInfo,crtPwd))
continue;
//clean login string
memset(crtLogin+strlen(crtLogin),0,(LOGIN_MAX_LEN+1-strlen(crtLogin))*sizeof(char));
if ((strcmp(crtLogin,"") == 0) || (strcmp(crtPwd,"") == 0))
continue;
if (!SetLoginToIndex(c, &tmpFileInfo, crtLogin))
{
printf("Error - Cannot add a login on the temporary file\n");
return 0;
}
if (!SetPwdToIndex(c, &tmpFileInfo, crtPwd))
{
printf("Error - Cannot add a password on the temporary file\n");
return 0;
}
c++;
}
CloseUserFile(&fileInfo);
CloseUserFile(&tmpFileInfo);
char cmd[2048];
sprintf(cmd,"cp %s %s",tmpname,refname);
system(cmd);
sprintf(cmd,"rm %s",tmpname);
system(cmd);
return 1;
}
//---------------------------------------------------------------------------
int CreateSaveUserFile(void)
{
char refname[FILE_PATH_LEN];
char savename[FILE_PATH_LEN];
if (!GetUserFilePath(refname))
return 0;
strcpy(savename,refname);
strcat(savename,"~");
char cmd[2048];
sprintf(cmd,"cp %s %s",refname,savename);
system(cmd);
return 1;
}
//---------------------------------------------------------------------------
int GetPwdFromIndex(int index, t_UserFileInfo *fileInfo, char *pwd_hash)
{
long start[2] = {0L,0L}, count[2]={1L,1L};
start[0] = index;
count[1] = fileInfo->PwdLen;
return (nc_get_vara_text(fileInfo->ncID,fileInfo->PwdID,(size_t *)start,(size_t *)count, pwd_hash) == NC_NOERR);
}
//---------------------------------------------------------------------------
int GetLoginFromIndex(int index, t_UserFileInfo *fileInfo, char *login)
{
long start[2] = {0L,0L}, count[2]={1L,1L};
start[0] = index;
count[1] = fileInfo->UserLen;
return (nc_get_vara_text(fileInfo->ncID,fileInfo->MemberID,(size_t *)start,(size_t *)count, login) == NC_NOERR);
}
//--------------------------------------------------------------------------
int SetPwdToIndex(int index, t_UserFileInfo *fileInfo, char *pwd_hash)
{
long start[2] = {0L,0L}, count[2]={1L,1L};
start[0] = index;
count[1] = fileInfo->PwdLen;
return (nc_put_vara_text(fileInfo->ncID,fileInfo->PwdID,(size_t *)start,(size_t *)count, pwd_hash) == NC_NOERR);
}
//---------------------------------------------------------------------------
int SetLoginToIndex(int index, t_UserFileInfo *fileInfo, char *login)
{
long start[2] = {0L,0L}, count[2]={1L,1L};
start[0] = index;
count[1] = fileInfo->UserLen;
return (nc_put_vara_text(fileInfo->ncID,fileInfo->MemberID,(size_t *)start,(size_t *)count, login) == NC_NOERR);
}
//---------------------------------------------------------------------------
int SearchLoginIndex(char *login, t_UserFileInfo *fileInfo)
{
char crtLogin[LOGIN_MAX_LEN+1];
int i;
for(i = 0; i < fileInfo->MaxRecords; i++)
{
if (!GetLoginFromIndex(i,fileInfo,crtLogin))
continue;
crtLogin[fileInfo->UserLen] = '\0';
if(strcmp(crtLogin,login) == 0)
return i;
}
return -1;
}
//--------------------------------------------------------------------------
int AddUser(t_Request request, t_UserFileInfo *fileInfo)
{
if (!SetLoginToIndex(fileInfo->MaxRecords,fileInfo,request.login))
{
printf("Error to add new login user");
return 0;
}
if (!SetPwdToIndex(fileInfo->MaxRecords,fileInfo,request.pwd_hash))
{
printf("Error to add new login user");
return 0;
}
return 1;
}
//-------------------------------------------------------------------------
int ModifyUser(t_Request request, t_UserFileInfo *fileInfo, int check)
{
int index = SearchLoginIndex(request.login, fileInfo);
if (index < 0)
{
printf("User %s not found\n",request.login);
return 0;
}
if (check)
{
char pwd_hash[PWD_HASHED_LEN+1];
memset(pwd_hash,0,(PWD_HASHED_LEN+1)*sizeof(char));
if (!GetPwdFromIndex(index,fileInfo,pwd_hash))
{
printf("Error to get user password\n");
return 0;
}
if (strcmp(pwd_hash,request.pwd_hash) != 0)
{
printf("Bad password\n");
return 0;
}
}
if (!SetPwdToIndex(index,fileInfo,request.pwd_hash_new))
{
printf("Error to set new user password\n");
return 0;
}
return 1;
}
//--------------------------------------------------------------------------
int DeleteUser(t_Request request, t_UserFileInfo *fileInfo)
{
int index = SearchLoginIndex(request.login, fileInfo);
if (index < 0)
{
printf("User %s not found\n",request.login);
return 0;
}
char login[LOGIN_MAX_LEN+1];
memset(login,0,(LOGIN_MAX_LEN+1)*sizeof(char));
if (!SetLoginToIndex(index,fileInfo,login))
{
printf("Error to delete user password\n");
return 0;
}
char pwd_hash[PWD_HASHED_LEN+1];
memset(pwd_hash,0,(PWD_HASHED_LEN+1)*sizeof(char));
if (!SetPwdToIndex(index,fileInfo,pwd_hash))
{
printf("Error to delete user password\n");
return 0;
}
return 1;
}
//--------------------------------------------------------------------------
int ResetUser(t_Request request, t_UserFileInfo *fileInfo)
{
char salt[2];
salt[0] = GetRandomChar();
char pwd[PWD_GEN_SIZE+1];
memset(pwd,0,(PWD_GEN_SIZE+1)*sizeof(char));
GeneratePwd(pwd);
printf("%s\n",pwd);
salt[1] = GetRandomChar();
//hash pwd
strcpy(request.pwd_hash_new,crypt(pwd,salt));
memset(pwd,0,(PWD_GEN_SIZE+1)*sizeof(char));
return ModifyUser(request, fileInfo, 0);
}
//--------------------------------------------------------------------------
int GetSalt(t_Request request, t_UserFileInfo *fileInfo)
{
int index = SearchLoginIndex(request.login, fileInfo);
if (index < 0)
{
printf("User %s not found\n",request.login);
return 0;
}
char pwd_hash[PWD_HASHED_LEN+1];
if (!GetPwdFromIndex(index,fileInfo,pwd_hash))
{
printf("Error to get user password\n");
return 0;
}
char salt[3];
strncpy(salt,pwd_hash,2);
salt[2] = '\0';
printf("%s\n",salt);
return 1;
}
//---------------------------------------------------------------------------
int GetUsersList(t_Request request, t_UserFileInfo *fileInfo)
{
char crtLogin[LOGIN_MAX_LEN+1];
int i;
int addComa = 0;
for(i = 0; i < fileInfo->MaxRecords; i++)
{
if (!GetLoginFromIndex(i,fileInfo,crtLogin))
continue;
if (addComa)
printf(",");
printf("%s",crtLogin);
addComa = 1;
}
printf("\n");
return 1;
}
//---------------------------------------------------------------------------
int CompleteRequest(t_Request *request, t_UserFileInfo *fileInfo)
{
char salt[2];
salt[0] = GetRandomChar();
//get login
int isFinish = 0;
while (!isFinish)
{
GetLogin(request->login);
if (SearchLoginIndex(request->login, fileInfo) > -1)
printf("User login not available. Change your login please.\n");
else
isFinish = 1;
}
//get password
char pwd[PWD_MAX_LEN+1];
if (!GetNewPwd(pwd))
return 0;
salt[1] = GetRandomChar();
//hash pwd
strcpy(request->pwd_hash,crypt(pwd,salt));
memset(pwd,0,(PWD_MAX_LEN+1)*sizeof(char));
return 1;
}
//---------------------------------------------------------------------------
main (int argc, char *argv[])
{
srand(time(NULL));
t_Request request;
if (!GetRequest(argc, argv, &request))
exit(ERR_BAD_REQUEST);
char refname[FILE_PATH_LEN];
if (!GetUserFilePath(refname))
exit(ERR_DDBASE_UNDEFINED);
t_UserFileInfo fileInfo;
memset(&fileInfo,0,sizeof(t_UserFileInfo));
if (!OpenUserFile(refname,&fileInfo))
exit(ERR_FILE_UNREACHABLE);
if (!GetFileInfo(&fileInfo))
exit(ERR_FILE_BAD_INFO);
if (request.op == OP_ADD_MANUAL)
if (!CompleteRequest(&request,&fileInfo))
{
CloseUserFile(&fileInfo);
exit(ERR_MANUAL_ABORTED);
}
int res = 0;
if ((request.op != OP_GET_SALT) && (request.op != OP_GET_LIST))
CreateSaveUserFile();
switch (request.op)
{
case OP_ADD_MANUAL :
case OP_ADD_AUTO :
res = AddUser(request,&fileInfo);
break;
case OP_MODIFY :
res = ModifyUser(request,&fileInfo,1);
break;
case OP_DELETE :
res = DeleteUser(request,&fileInfo);
break;
case OP_RESET :
res = ResetUser(request,&fileInfo);
break;
case OP_GET_SALT :
res = GetSalt(request,&fileInfo);
break;
case OP_GET_LIST :
res = GetUsersList(request,&fileInfo);
break;
}
CloseUserFile(&fileInfo);
if (res && (request.op == OP_DELETE))
CleanUserFile();
memset(&request,0,sizeof(t_Request));
if (!res)
exit(ERR_REQUEST_FAILED);
return 0;
}