#include "libmsrpc.h"Go to the source code of this file.
Functions | |
| void | cactest_GetAuthDataFn (const char *pServer, const char *pShare, char *pWorkgroup, int maxLenWorkgroup, char *pUsername, int maxLenUsername, char *pPassword, int maxLenPassword) |
| void | cactest_print_usage (char **argv) |
| void | cac_parse_cmd_line (int argc, char **argv, CacServerHandle *hnd) |
| void | print_value (uint32 type, REG_VALUE_DATA *data) |
| void | cactest_readline (FILE *in, fstring line) |
| void | cactest_reg_input_val (TALLOC_CTX *mem_ctx, int *type, char **name, REG_VALUE_DATA *data) |
| void | print_cac_user_info (CacUserInfo *info) |
| void | edit_cac_user_info (TALLOC_CTX *mem_ctx, CacUserInfo *info) |
| void | print_cac_group_info (CacGroupInfo *info) |
| void | edit_cac_group_info (TALLOC_CTX *mem_ctx, CacGroupInfo *info) |
| void | print_cac_domain_info (CacDomainInfo *info) |
| void | print_cac_service (CacService svc) |
| void | print_service_status (SERVICE_STATUS status) |
| void | print_service_config (CacServiceConfig *config) |
|
||||||||||||||||
|
Definition at line 13 of file test_util.c. References cac_FreeHandle(), cactest_print_usage(), _CACSERVERHANDLE::debug, _CACSERVERHANDLE::domain, _CACSERVERHANDLE::netbios_name, _CACSERVERHANDLE::password, _CACSERVERHANDLE::server, _CACSERVERHANDLE::username, and ZERO_STRUCTP. Referenced by main(). 00013 { 00014 int i = 0; 00015 00016 ZERO_STRUCTP(hnd->username); 00017 ZERO_STRUCTP(hnd->domain); 00018 ZERO_STRUCTP(hnd->netbios_name); 00019 ZERO_STRUCTP(hnd->password); 00020 00021 for(i = 1; i < argc; i++) { 00022 if( strncmp(argv[i], "-U", sizeof(fstring)) == 0) { 00023 strncpy(hnd->username, argv[i+1], sizeof(fstring)); 00024 i++; 00025 } 00026 00027 else if(strncmp(argv[i], "-W", sizeof(fstring)) == 0) { 00028 strncpy(hnd->domain, argv[i+1], sizeof(fstring)); 00029 i++; 00030 00031 } 00032 00033 else if(strncmp(argv[i], "-P", sizeof(fstring)) == 0) { 00034 strncpy(hnd->password, argv[i+1], sizeof(fstring)); 00035 i++; 00036 00037 } 00038 00039 else if(strncmp(argv[i], "-N", sizeof(fstring)) == 0) { 00040 strncpy(hnd->netbios_name, argv[i+1], sizeof(fstring)); 00041 i++; 00042 } 00043 00044 else if(strncmp(argv[i], "-d", sizeof(fstring)) == 0) { 00045 sscanf(argv[i+1], "%d", &hnd->debug); 00046 i++; 00047 } 00048 00049 else { /*assume this is the server name*/ 00050 strncpy(hnd->server, argv[i], sizeof(fstring)); 00051 } 00052 } 00053 00054 if(!hnd->server) { 00055 cactest_print_usage(argv); 00056 cac_FreeHandle(hnd); 00057 exit(-1); 00058 } 00059 00060 }
|
|
||||||||||||||||||||||||||||||||||||
|
Definition at line 117 of file test_util.c. References d_printf(), and fstrcpy. Referenced by main(). 00126 { 00127 char temp[sizeof(fstring)]; 00128 00129 static char authUsername[sizeof(fstring)]; 00130 static char authWorkgroup[sizeof(fstring)]; 00131 static char authPassword[sizeof(fstring)]; 00132 static char authSet = 0; 00133 00134 char *pass = NULL; 00135 00136 if (authSet) 00137 { 00138 strncpy(pWorkgroup, authWorkgroup, maxLenWorkgroup - 1); 00139 strncpy(pUsername, authUsername, maxLenUsername - 1); 00140 strncpy(pPassword, authPassword, maxLenPassword - 1); 00141 } 00142 else 00143 { 00144 if(pWorkgroup[0] != '\0') { 00145 strncpy(authWorkgroup, pWorkgroup, maxLenWorkgroup - 1); 00146 } 00147 else { 00148 d_printf("Domain: [%s] ", pWorkgroup); 00149 fscanf(stdin, "%s", temp); 00150 00151 if (temp[0] != '\0') 00152 { 00153 strncpy(pWorkgroup, temp, maxLenWorkgroup - 1); 00154 strncpy(authWorkgroup, temp, maxLenWorkgroup - 1); 00155 } 00156 } 00157 00158 00159 if(pUsername[0] != '\0') { 00160 strncpy(authUsername, pUsername, maxLenUsername - 1); 00161 } 00162 else { 00163 d_printf("Username: [%s] ", pUsername); 00164 fscanf(stdin, "%s", temp); 00165 00166 if (temp[strlen(temp) - 1] == '\n') /* A new line? */ 00167 { 00168 temp[strlen(temp) - 1] = '\0'; 00169 } 00170 00171 if (temp[0] != '\0') 00172 { 00173 strncpy(pUsername, temp, maxLenUsername - 1); 00174 strncpy(authUsername, pUsername, maxLenUsername - 1); 00175 } 00176 } 00177 if(pPassword[0] != '\0') { 00178 strncpy(authPassword, pPassword, maxLenPassword - 1); 00179 } 00180 else { 00181 pass = getpass("Password: "); 00182 if (pass) 00183 fstrcpy(temp, pass); 00184 if (temp[strlen(temp) - 1] == '\n') /* A new line? */ 00185 { 00186 temp[strlen(temp) - 1] = '\0'; 00187 } 00188 if (temp[0] != '\0') 00189 { 00190 strncpy(pPassword, temp, maxLenPassword - 1); 00191 strncpy(authPassword, pPassword, maxLenPassword - 1); 00192 } 00193 } 00194 authSet = 1; 00195 } 00196 }
|
|
|
Definition at line 7 of file test_util.c. References printf(). Referenced by cac_parse_cmd_line(). 00007 { 00008 printf("Usage:\n"); 00009 printf(" %s server [-U username] [-W domain] [-P passwprd] [-N netbios_name]\n", argv[0]); 00010 }
|
|
||||||||||||
|
Definition at line 102 of file test_util.c. References c. Referenced by cactest_reg_input_val(), and main(). 00102 { 00103 00104 int c; 00105 00106 c = fgetc(in); 00107 if(c != '\n') 00108 ungetc(c, in); 00109 00110 fgets(line, sizeof(fstring), in); 00111 00112 if(line[strlen(line) - 1] == '\n') 00113 line[strlen(line) - 1] = '\0'; 00114 00115 }
|
|
||||||||||||||||||||
|
Definition at line 198 of file test_util.c. References cactest_readline(), _REGMULTISZDATA::num_strings, printf(), _REGVALUEDATA::reg_dword, REG_DWORD, _REGVALUEDATA::reg_multi_sz, REG_MULTI_SZ, _REGVALUEDATA::reg_sz, REG_SZ, _REGMULTISZDATA::strings, talloc_array, and talloc_strdup(). Referenced by main(). 00198 { 00199 fstring tmp; 00200 int i; 00201 00202 printf("Enter value name: \n"); 00203 cactest_readline(stdin, tmp); 00204 *name = talloc_strdup(mem_ctx, tmp); 00205 00206 do { 00207 printf("Enter type. %d = REG_SZ, %d = REG_DWORD, %d = REG_MULTI_SZ: ", REG_SZ, REG_DWORD, REG_MULTI_SZ); 00208 scanf("%d", type); 00209 } while(*type != REG_SZ && *type != REG_DWORD && *type != REG_MULTI_SZ); 00210 00211 switch(*type) { 00212 case REG_SZ: 00213 printf("Enter string:\n"); 00214 cactest_readline(stdin, tmp); 00215 00216 data->reg_sz = talloc_strdup(mem_ctx, tmp); 00217 break; 00218 00219 case REG_DWORD: 00220 printf("Enter dword: "); 00221 scanf("%d", &data->reg_dword); 00222 break; 00223 00224 case REG_MULTI_SZ: 00225 printf("Enter number of strings: "); 00226 scanf("%d", &data->reg_multi_sz.num_strings); 00227 00228 data->reg_multi_sz.strings = talloc_array(mem_ctx, char *, data->reg_multi_sz.num_strings); 00229 00230 for(i = 0; i < data->reg_multi_sz.num_strings; i++) { 00231 printf("String %d: ", i+1); 00232 cactest_readline(stdin, tmp); 00233 00234 data->reg_multi_sz.strings[i] = talloc_strdup(mem_ctx, tmp); 00235 } 00236 break; 00237 } 00238 }
|
|
||||||||||||
|
Definition at line 320 of file test_util.c. References _CACGROUPINFO::description, edit_readline(), _CACGROUPINFO::name, printf(), and talloc_strdup(). Referenced by main(). 00320 { 00321 fstring tmp; 00322 00323 printf("Group Name [%s]: ", info->name); 00324 edit_readline(tmp); 00325 if(tmp[0] != '\0') 00326 info->name = talloc_strdup(mem_ctx, tmp); 00327 00328 printf("Description [%s]: ", info->description); 00329 edit_readline(tmp); 00330 if(tmp[0] != '\0') 00331 info->description = talloc_strdup(mem_ctx, tmp); 00332 }
|
|
||||||||||||
|
Definition at line 276 of file test_util.c. References _CACUSERINFO::acb_mask, _CACUSERINFO::description, _CACUSERINFO::dial, edit_readline(), _CACUSERINFO::full_name, _CACUSERINFO::pass_must_change, printf(), talloc_strdup(), True, and _CACUSERINFO::username. Referenced by main(). 00276 { 00277 fstring tmp; 00278 00279 printf(" User Name [%s]: ", info->username); 00280 edit_readline(tmp); 00281 00282 if(tmp[0] != '\0') 00283 info->username = talloc_strdup(mem_ctx, tmp); 00284 00285 printf(" Full Name [%s]: ", info->full_name); 00286 00287 edit_readline(tmp); 00288 if(tmp[0] != '\0') 00289 info->full_name = talloc_strdup(mem_ctx, tmp); 00290 00291 printf(" Description [%s]: ", info->description); 00292 edit_readline(tmp); 00293 if(tmp[0] != '\0') 00294 info->description = talloc_strdup(mem_ctx, tmp); 00295 00296 printf(" Remote Dial [%s]: ", info->dial); 00297 edit_readline(tmp); 00298 if(tmp[0] != '\0') 00299 info->dial = talloc_strdup(mem_ctx, tmp); 00300 00301 printf(" ACB Mask [0x%x]: ", info->acb_mask); 00302 edit_readline(tmp); 00303 if(tmp[0] != '\0') 00304 sscanf(tmp, "%x", &info->acb_mask); 00305 00306 printf(" Must change pass at next logon? [y/N]: "); 00307 edit_readline(tmp); 00308 00309 if(tmp[0] == 'y' || tmp[0] == 'Y') 00310 info->pass_must_change= True; 00311 00312 }
|
|
|
Definition at line 360 of file test_util.c. References cactime_str(), _CACDOMINFO::comment, _CACDOMINFO::domain_name, _CACDOMINFO::expire, _CACDOMINFO::lockout_duration, _CACDOMINFO::min_pass_age, _CACDOMINFO::min_pass_length, _CACDOMINFO::num_bad_attempts, _CACDOMINFO::num_domain_groups, _CACDOMINFO::num_local_groups, _CACDOMINFO::num_users, _CACDOMINFO::pass_history, printf(), _CACDOMINFO::server_name, _CACDOMINFO::server_role, and srv_role_str(). Referenced by main(). 00360 { 00361 fstring tmp; 00362 00363 printf(" Server Role : %s\n", srv_role_str(info->server_role)); 00364 printf(" Num Users : %d\n", info->num_users); 00365 printf(" Num Domain Groups: %d\n", info->num_domain_groups); 00366 printf(" Num Local Groups : %d\n", info->num_local_groups); 00367 printf(" Comment : %s\n", info->comment); 00368 printf(" Domain Name : %s\n", info->domain_name); 00369 printf(" Server Name : %s\n", info->server_name); 00370 printf(" Min. Pass. Length: %d\n", info->min_pass_length); 00371 printf(" Password History : %d\n", info->pass_history); 00372 printf("\n"); 00373 printf(" Passwords Expire In : %s\n", cactime_str(info->expire, tmp)); 00374 printf(" Passwords Can Change in: %s\n", cactime_str(info->min_pass_age, tmp)); 00375 printf(" Lockouts last : %s\n", cactime_str(info->lockout_duration, tmp)); 00376 printf(" Allowed Bad Attempts : %d\n", info->num_bad_attempts); 00377 }
|
|
|
Definition at line 314 of file test_util.c. References _CACGROUPINFO::description, _CACGROUPINFO::name, _CACGROUPINFO::num_members, and printf(). Referenced by main(). 00314 { 00315 printf(" Group Name : %s\n", info->name); 00316 printf(" Description : %s\n", info->description); 00317 printf(" Num Members : %d\n", info->num_members); 00318 }
|
|
|
Definition at line 379 of file test_util.c. References _CACSERVICE::display_name, print_service_status(), printf(), _CACSERVICE::service_name, and _CACSERVICE::status. Referenced by main(). 00379 { 00380 printf("\tService Name: %s\n", svc.service_name); 00381 printf("\tDisplay Name: %s\n", svc.display_name); 00382 print_service_status(svc.status); 00383 }
|
|
|
|
Definition at line 397 of file test_util.c. References __CACSERVICECONFIG::dependencies, __CACSERVICECONFIG::display_name, __CACSERVICECONFIG::error_control, __CACSERVICECONFIG::exe_path, __CACSERVICECONFIG::load_order_group, printf(), __CACSERVICECONFIG::start_name, __CACSERVICECONFIG::start_type, __CACSERVICECONFIG::tag_id, and __CACSERVICECONFIG::type. Referenced by main(). 00397 { 00398 printf("\tConfig:\n"); 00399 printf("\tType: 0x%x\n", config->type); 00400 printf("\tStart Type: 0x%x\n", config->start_type); 00401 printf("\tError config: 0x%x\n", config->error_control); 00402 printf("\tExecutable Path: %s\n", config->exe_path); 00403 printf("\tLoad Order Group: %s\n", config->load_order_group); 00404 printf("\tTag ID: 0x%x\n", config->tag_id); 00405 printf("\tDependencies: %s\n", config->dependencies); 00406 printf("\tStart Name: %s\n", config->start_name); 00407 printf("\tDisplay Name: %s\n", config->display_name); 00408 }
|
|
|
Definition at line 385 of file test_util.c. References SERVICE_STATUS::check_point, SERVICE_STATUS::controls_accepted, printf(), SERVICE_STATUS::service_exit_code, SERVICE_STATUS::state, SERVICE_STATUS::type, SERVICE_STATUS::wait_hint, and SERVICE_STATUS::win32_exit_code. Referenced by main(), and print_cac_service(). 00385 { 00386 printf("\tStatus:\n"); 00387 printf("\t Type: 0x%x\n", status.type); 00388 printf("\t State: 0x%x\n", status.state); 00389 printf("\t Controls: 0x%x\n", status.controls_accepted); 00390 printf("\t W32 Exit Code: 0x%x\n", status.win32_exit_code); 00391 printf("\t SVC Exit Code: 0x%x\n", status.service_exit_code); 00392 printf("\t Checkpoint: 0x%x\n", status.check_point); 00393 printf("\t Wait Hint: 0x%x\n", status.wait_hint); 00394 printf("\n"); 00395 }
|
|
||||||||||||
|
Definition at line 62 of file test_util.c. References _REGMULTISZDATA::num_strings, printf(), REG_BINARY, _REGVALUEDATA::reg_dword, REG_DWORD, _REGVALUEDATA::reg_dword_be, REG_DWORD_BE, _REGVALUEDATA::reg_expand_sz, REG_EXPAND_SZ, _REGVALUEDATA::reg_multi_sz, REG_MULTI_SZ, _REGVALUEDATA::reg_sz, REG_SZ, and _REGMULTISZDATA::strings. Referenced by main(). 00062 { 00063 int i = 0; 00064 00065 switch(type) { 00066 case REG_SZ: 00067 printf(" Type: REG_SZ\n"); 00068 printf(" Value: %s\n", data->reg_sz); 00069 break; 00070 case REG_EXPAND_SZ: 00071 printf(" Type: REG_EXPAND_SZ\n"); 00072 printf(" Value: %s\n", data->reg_expand_sz); 00073 break; 00074 case REG_MULTI_SZ: 00075 printf(" Type: REG_MULTI_SZ\n"); 00076 printf(" Values: "); 00077 00078 for(i = 0; i < data->reg_multi_sz.num_strings; i++) { 00079 printf(" %d: %s\n", i, data->reg_multi_sz.strings[i]); 00080 } 00081 break; 00082 case REG_DWORD: 00083 printf(" Type: REG_DWORD\n"); 00084 printf(" Value: %d\n", data->reg_dword); 00085 break; 00086 case REG_DWORD_BE: 00087 printf(" Type: REG_DWORD_BE\n"); 00088 printf(" Value: 0x%x\n", data->reg_dword_be); 00089 break; 00090 case REG_BINARY: 00091 printf(" Type: REG_BINARY\n"); 00092 break; 00093 default: 00094 printf(" Invalid type: %d\n", type); 00095 00096 } 00097 00098 printf("\n"); 00099 00100 }
|