Diff for /libaitcfg/example/test_pwd.c between versions 1.1.2.7 and 1.1.2.8

version 1.1.2.7, 2012/09/19 12:35:10 version 1.1.2.8, 2012/09/19 12:43:12
Line 68  int main() Line 68  int main()
         u = (struct tagUser *) cfg_getPasswd(&db, PWD_CRIT_NAME, "");          u = (struct tagUser *) cfg_getPasswd(&db, PWD_CRIT_NAME, "");
         printf("cfg_getPasswd %p NAME \"\"\n", u);          printf("cfg_getPasswd %p NAME \"\"\n", u);
   
        printf("cfg_setPasswd %p\n", cfg_setPasswd(&db, 3, "use", "alabala", 101, 0,         printf("\n----------\n");
 
         /* unit test set */
         printf("cfg_setPasswd %p\n", cfg_setPasswd(&db, 4, "use", "alabala", 101, 4, 
                                 NULL, 0, 0, NULL, NULL, NULL));                                  NULL, 0, 0, NULL, NULL, NULL));
        printf("cfg_setPasswd %p\n", cfg_setPasswd(&db, 4, "use", "alabala", 101, 0,         printf("cfg_setPasswd %p\n", cfg_setPasswd(&db, 3, "use", "alabala", 101, 3, 
                                 NULL, 0, 0, NULL, NULL, NULL));                                  NULL, 0, 0, NULL, NULL, NULL));
           printf("cfg_setPasswd %p\n", cfg_setPasswd(&db, 3, "user_l", "pliok", 999, 3, 
                                   NULL, 0, 0, NULL, NULL, NULL));
           printf("cfg_setPasswd %p\n", cfg_setPasswd(&db, 2, "use1", "WC_00", 0, 0, 
                                   NULL, 0, 0, NULL, NULL, NULL));
           printf("cfg_setPasswd %p\n", cfg_setPasswd(&db, 0, "USE1", "WC_00", 10000, 20, 
                                   NULL, 0, 0, "TEST for use", "/home/USE1", "/bin/sh"));
           printf("cfg_setPasswd %p\n", cfg_setPasswd(&db, 0, "USE2", "WC_!!", 10001, 20, 
                                   NULL, 0, 0, "TEST for use", "/home/USE2", NULL));
   
#if 0        printf("\n----------\n");
        /* unit test set */ 
        printf("attr=%d set %d NULL\n", ALL, pwd_SetAttribute(&db, ALL, NULL)); 
        printf("attr=%d set %d w/ empty\n", ALL, pwd_SetAttribute(&db, ALL, ddd)); 
        pwdSetValue(&ddd, ALL, "use"); 
        pwdSetValue(&ddd, Password, "alabala"); 
        pwdSetValue(&ddd, UID, "101"); 
        pwdGetValue(ddd, Password, str, 256); 
        printf("attr=%d set %d use getvalue=%s\n", ALL, pwd_SetAttribute(&db, ALL, ddd), str); 
        pwdFreeValue(&ddd, ALL); 
   
        pwdSetValue(&ddd, ALL, "user_l");#if 0
        pwdSetValue(&ddd, UID, "999"); 
        pwdSetValue(&ddd, Password, "pliok"); 
        pwdGetValue(ddd, Username, str, 256); 
        printf("attr=%d %s db=%p ddd=%p set %d\n", ALL, str, db, ddd, pwd_SetAttribute(&db, ALL, ddd)); 
        pwdSetValue(&ddd, Username, "use"); 
        pwdSetValue(&ddd, Password, "WC_00"); 
        printf("2.attr=%d %s db=%p ddd=%p set %d\n", Password, str, db, ddd, pwd_SetAttribute(&db, Password, ddd)); 
        printf("get fail.attr=%d %s db=%p ddd=%p set %d\n", Password, str, db, ddd, pwd_GetAttribute(db, Password, ddd)); 
        pwdFreeValue(&ddd, ALL); 
        /* unit end set */ 
        /* unit test get */ 
        pwdSetValue(&ddd, ALL, "user_l"); 
        printf("GET attr=%d %s db=%p ddd=%p set %d\n", Password, ddd->psPass, db, ddd, pwd_GetAttribute(db, Password, ddd)); 
        pwdFreeValue(&ddd, ALL); 
        /* unit end set */ 
 
         /* unit test unset */          /* unit test unset */
         pwdSetValue(&ddd, ALL, "ttt");          pwdSetValue(&ddd, ALL, "ttt");
         printf("attr=%d Count of array %d w/ NULL \n", Username, pwd_FindAttribute(db, Username, ddd->psUser));          printf("attr=%d Count of array %d w/ NULL \n", Username, pwd_FindAttribute(db, Username, ddd->psUser));
Line 128  int main() Line 114  int main()
                         printf("Access granted - user found at position %d\n", ret);                          printf("Access granted - user found at position %d\n", ret);
         }          }
         pwdFreeValue(&ddd, ALL);          pwdFreeValue(&ddd, ALL);
   #endif
   
        if (CreatePasswd("test4e.pwd", &db)) {        if (cfgCreatePasswd("test4e.pwd", &db)) {
                printf("Error #%d - %s\n", pwd_GetErrno(), pwd_GetError());                printf("Error #%d - %s\n", cfg_GetErrno(), cfg_GetError());
                 return 2;                  return 2;
         }          }
 #endif  
   
         cfgUnloadPasswd(&db);          cfgUnloadPasswd(&db);
         return 0;          return 0;

Removed from v.1.1.2.7  
changed lines
  Added in v.1.1.2.8


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>