#include "libmsrpc.h"#include "includes.h"Go to the source code of this file.
Defines | |
| #define | DEFAULT_SCREEN_LINES 20 |
Functions | |
| void | usage () |
| int | process_cmd_line (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, int argc, char **argv) |
| void | mgr_getline (fstring line) |
| void | mgr_page (uint32 line_count) |
| uint32 | rid_or_name (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *dom_hnd, uint32 *rid, char **name) |
| char * | get_new_password (TALLOC_CTX *mem_ctx) |
| void | printerr (const char *msg, NTSTATUS status) |
| void | print_rid_list (uint32 *rids, char **names, uint32 num_rids) |
| void | print_lookup_records (CacLookupRidsRecord *map, uint32 num_rids) |
| int | list_groups (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *dom_hnd) |
| void | list_privs (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, CacUserInfo *info) |
| void | add_privs (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, CacUserInfo *info) |
| void | list_users (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *dom_hnd) |
| void | mgr_GetAuthDataFn (const char *pServer, const char *pShare, char *pWorkgroup, int maxLenWorkgroup, char *pUsername, int maxLenUsername, char *pPassword, int maxLenPassword) |
| void | group_menu (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *dom_hnd, POLICY_HND *group_hnd) |
| void | user_menu (CacServerHandle *hnd, TALLOC_CTX *mem_ctx, POLICY_HND *dom_hnd, POLICY_HND *user_hnd) |
|
|
Definition at line 28 of file cacusermgr.h. Referenced by mgr_page(). |
|
||||||||||||||||
|
|
|
|
Definition at line 265 of file util.c. References talloc_strdup(). Referenced by user_menu(). 00265 { 00266 char *pass1 = NULL; 00267 00268 pass1 = getpass("Enter new password: "); 00269 00270 return talloc_strdup(mem_ctx, pass1); 00271 }
|
|
||||||||||||||||||||
|
Definition at line 74 of file mgr_group.c. References buf, cac_SamAddGroupMember(), cac_SamClose(), cac_SamDeleteGroup(), cac_SamGetGroupMembers(), cac_SamGetNamesFromRids(), cac_SamRemoveGroupMember(), CAC_USER_RID, get_group_info(), SamSetGroupInfo::in, SamAddGroupMember::in, SamRemoveGroupMember::in, SamGetGroupMembers::in, SamGetNamesFromRids::in, SamSetGroupInfo::info, list_users(), mgr_getline(), modify_group_info(), SamGetGroupMembers::out, SamGetNamesFromRids::out, print_group_info(), print_lookup_records(), printerr(), printf(), rid_or_name(), _CACSERVERHANDLE::status, and ZERO_STRUCT. Referenced by create_menu(), and main_menu(). 00074 { 00075 CacGroupInfo *info = NULL; 00076 int rid_type = 0; 00077 00078 fstring in; 00079 00080 char *buf; 00081 00082 struct SamGetGroupMembers getmem; 00083 struct SamGetNamesFromRids getnames; 00084 struct SamAddGroupMember add; 00085 struct SamRemoveGroupMember del; 00086 00087 info = get_group_info(hnd, mem_ctx, group_hnd); 00088 00089 printf("\n"); 00090 print_group_info(info); 00091 00092 while(in[0] != 'b' && in[0] != 'B' && in[0] != 'q' && in[0] != 'Q') { 00093 printf("\n"); 00094 printf("[m] List Group Members\n"); 00095 printf("[a] Add User To Group\n"); 00096 printf("[r] Remove User From Group\n"); 00097 printf("[l] List Users\n"); 00098 printf("[v] View Group Info\n"); 00099 printf("[d] Set Group Description\n"); 00100 printf("[x] Delete Group\n"); 00101 printf("[b] Back\n\n"); 00102 00103 printf("Command: "); 00104 mgr_getline(in); 00105 00106 printf("\n"); 00107 00108 switch(in[0]) { 00109 case 'a': /*add member to group*/ 00110 case 'A': 00111 ZERO_STRUCT(add); 00112 add.in.group_hnd = group_hnd; 00113 00114 printf("Enter RID or Name: "); 00115 rid_type = rid_or_name(hnd, mem_ctx, dom_hnd, &add.in.rid, &buf); 00116 00117 if(rid_type != CAC_USER_RID) { 00118 printf("Invalid User.\n"); 00119 break; 00120 } 00121 00122 if(!cac_SamAddGroupMember(hnd, mem_ctx, &add)) { 00123 printerr("Could not add user to group.", hnd->status); 00124 } 00125 break; 00126 00127 case 'r': /*remove user from group*/ 00128 case 'R': 00129 ZERO_STRUCT(del); 00130 del.in.group_hnd = group_hnd; 00131 00132 printf("Enter RID or Name: "); 00133 rid_type = rid_or_name(hnd, mem_ctx, dom_hnd, &del.in.rid, &buf); 00134 00135 if(rid_type != CAC_USER_RID) { 00136 printf("Invalid User.\n"); 00137 break; 00138 } 00139 00140 if(!cac_SamRemoveGroupMember(hnd, mem_ctx, &del)) { 00141 printerr("Could not remove use from group.", hnd->status); 00142 } 00143 break; 00144 00145 case 'l': /*list users*/ 00146 case 'L': 00147 list_users(hnd, mem_ctx, dom_hnd); 00148 break; 00149 00150 case 'm': /*list members*/ 00151 case 'M': 00152 ZERO_STRUCT(getmem); 00153 getmem.in.group_hnd = group_hnd; 00154 00155 if(!cac_SamGetGroupMembers(hnd, mem_ctx, &getmem)) { 00156 printerr("Could not get members.", hnd->status); 00157 break; 00158 } 00159 00160 ZERO_STRUCT(getnames); 00161 getnames.in.dom_hnd = dom_hnd; 00162 getnames.in.rids = getmem.out.rids; 00163 getnames.in.num_rids = getmem.out.num_members; 00164 00165 if(!cac_SamGetNamesFromRids(hnd, mem_ctx, &getnames)) { 00166 printerr("Could not lookup names.", hnd->status); 00167 break; 00168 } 00169 00170 printf("Group has %d members:\n", getnames.out.num_names); 00171 print_lookup_records(getnames.out.map, getnames.out.num_names); 00172 00173 break; 00174 00175 case 'd': /*set description*/ 00176 case 'D': 00177 info = modify_group_info(hnd, mem_ctx, group_hnd); 00178 00179 if(info) 00180 printf("Set Group Info.\n"); 00181 break; 00182 00183 case 'v': /*view info*/ 00184 case 'V': 00185 info = get_group_info(hnd, mem_ctx, group_hnd); 00186 print_group_info(info); 00187 break; 00188 00189 case 'x': /*delete group*/ 00190 case 'X': 00191 if(!cac_SamDeleteGroup(hnd, mem_ctx, group_hnd)) 00192 printerr("Could Not Delete Group.", hnd->status); 00193 00194 /*we want to go back to the main menu*/ 00195 in[0] = 'b'; 00196 break; 00197 00198 case 'b': /*back*/ 00199 case 'B': 00200 case 'q': 00201 case 'Q': 00202 break; 00203 00204 default: 00205 printf("Invalid Command.\n"); 00206 } 00207 } 00208 00209 cac_SamClose(hnd, mem_ctx, group_hnd); 00210 }
|
|
||||||||||||||||
|
Definition at line 309 of file util.c. References CAC_OP_FAILED, cac_SamEnumGroups(), SamEnumGroups::in, SamEnumGroups::out, print_rid_list(), printerr(), _CACSERVERHANDLE::status, and ZERO_STRUCT. Referenced by user_menu(). 00309 { 00310 struct SamEnumGroups eg; 00311 00312 if(!hnd || !mem_ctx || !dom_hnd) 00313 return 0; 00314 00315 ZERO_STRUCT(eg); 00316 eg.in.dom_hnd = dom_hnd; 00317 00318 while(cac_SamEnumGroups(hnd, mem_ctx, &eg)) 00319 print_rid_list(eg.out.rids, eg.out.names, eg.out.num_groups); 00320 00321 if(CAC_OP_FAILED(hnd->status)) { 00322 printerr("Could not enumerate groups.", hnd->status); 00323 return 0; 00324 } 00325 00326 return 1; 00327 }
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
Definition at line 329 of file util.c. References CAC_OP_FAILED, cac_SamEnumUsers(), SamEnumUsers::in, SamEnumUsers::out, print_rid_list(), printerr(), _CACSERVERHANDLE::status, and ZERO_STRUCT. Referenced by group_menu(), and main(). 00329 { 00330 struct SamEnumUsers eu; 00331 00332 if(!hnd || !mem_ctx || !dom_hnd) 00333 return; 00334 00335 ZERO_STRUCT(eu); 00336 eu.in.dom_hnd = dom_hnd; 00337 00338 while(cac_SamEnumUsers(hnd, mem_ctx, &eu)) 00339 print_rid_list(eu.out.rids, eu.out.names, eu.out.num_users); 00340 00341 if(CAC_OP_FAILED(hnd->status)) 00342 printerr("Could not enumerate users.", hnd->status); 00343 }
|
|
||||||||||||||||||||||||||||||||||||
|
Definition at line 99 of file util.c. References d_printf(), fstrcpy, and mgr_getline(). 00108 { 00109 char temp[sizeof(fstring)]; 00110 00111 static char authUsername[sizeof(fstring)]; 00112 static char authWorkgroup[sizeof(fstring)]; 00113 static char authPassword[sizeof(fstring)]; 00114 static char authSet = 0; 00115 00116 char *pass = NULL; 00117 00118 if (authSet) 00119 { 00120 strncpy(pWorkgroup, authWorkgroup, maxLenWorkgroup - 1); 00121 strncpy(pUsername, authUsername, maxLenUsername - 1); 00122 strncpy(pPassword, authPassword, maxLenPassword - 1); 00123 } 00124 else 00125 { 00126 if(pWorkgroup[0] != '\0') { 00127 strncpy(authWorkgroup, pWorkgroup, maxLenWorkgroup - 1); 00128 } 00129 else { 00130 d_printf("Domain: [%s] ", pWorkgroup); 00131 mgr_getline(pWorkgroup); 00132 00133 if (temp[0] != '\0') 00134 { 00135 strncpy(pWorkgroup, temp, maxLenWorkgroup - 1); 00136 strncpy(authWorkgroup, temp, maxLenWorkgroup - 1); 00137 } 00138 } 00139 00140 00141 if(pUsername[0] != '\0') { 00142 strncpy(authUsername, pUsername, maxLenUsername - 1); 00143 } 00144 else { 00145 d_printf("Username: [%s] ", pUsername); 00146 mgr_getline(pUsername); 00147 00148 if (temp[strlen(temp) - 1] == '\n') /* A new line? */ 00149 { 00150 temp[strlen(temp) - 1] = '\0'; 00151 } 00152 00153 if (temp[0] != '\0') 00154 { 00155 strncpy(pUsername, temp, maxLenUsername - 1); 00156 strncpy(authUsername, pUsername, maxLenUsername - 1); 00157 } 00158 } 00159 if(pPassword[0] != '\0') { 00160 strncpy(authPassword, pPassword, maxLenPassword - 1); 00161 } 00162 else { 00163 pass = getpass("Password: "); 00164 if (pass) 00165 fstrcpy(temp, pass); 00166 if (temp[strlen(temp) - 1] == '\n') /* A new line? */ 00167 { 00168 temp[strlen(temp) - 1] = '\0'; 00169 } 00170 if (temp[0] != '\0') 00171 { 00172 strncpy(pPassword, temp, maxLenPassword - 1); 00173 strncpy(authPassword, pPassword, maxLenPassword - 1); 00174 } 00175 } 00176 authSet = 1; 00177 } 00178 }
|
|
|
Definition at line 89 of file util.c. Referenced by create_menu(), group_menu(), main_menu(), mgr_GetAuthDataFn(), modify_group_info(), modify_user_info(), rid_or_name(), and user_menu(). 00089 { 00090 00091 fgets(line, sizeof(fstring), stdin); 00092 00093 if(line[strlen(line) - 1] == '\n') 00094 line[strlen(line) - 1] = '\0'; 00095 00096 }
|
|
|
Definition at line 180 of file util.c. References DEFAULT_SCREEN_LINES, and printf(). Referenced by print_lookup_records(), and print_rid_list(). 00180 { 00181 00182 if( (line_count % DEFAULT_SCREEN_LINES) != 0) 00183 return; 00184 00185 printf("--Press enter to continue--\n"); 00186 getchar(); 00187 }
|
|
||||||||||||
|
Definition at line 290 of file util.c. References _CACLOOKUPRIDSRECORD::found, mgr_page(), name, printf(), and uint32. Referenced by group_menu(), and user_menu(). 00290 { 00291 uint32 i = 0; 00292 00293 if(!map) 00294 return; 00295 00296 printf("RID Name\n"); 00297 00298 while(i < num_rids) { 00299 if(map[i].found) { 00300 printf("[0x%x] [%s]\n", map[i].rid, map[i].name); 00301 } 00302 00303 i++; 00304 00305 mgr_page(i); 00306 } 00307 }
|
|
||||||||||||||||
|
Definition at line 273 of file util.c. References mgr_page(), printf(), and uint32. Referenced by list_groups(), list_users(), and main_menu(). 00273 { 00274 uint32 i = 0; 00275 00276 if(!names || !rids) 00277 return; 00278 00279 printf(" RID Name\n"); 00280 00281 while(i < num_rids) { 00282 printf("[0x%x] [%s]\n", rids[i], names[i]); 00283 00284 i++; 00285 00286 mgr_page(i); 00287 } 00288 }
|
|
||||||||||||
|
||||||||||||||||||||
|
Definition at line 37 of file util.c. References _CACSERVERHANDLE::debug, _CACSERVERHANDLE::domain, optarg, optind, printf(), _CACSERVERHANDLE::server, usage(), and _CACSERVERHANDLE::username. Referenced by main(). 00037 { 00038 char op; 00039 00040 if(!hnd || !mem_ctx || !argc) 00041 return 0; 00042 00043 while( (op = getopt(argc, argv, "u:U:d:w:W:D:h")) != -1) { 00044 switch(op) { 00045 case 'u': /*username*/ 00046 case 'U': 00047 if(optarg) 00048 strncpy(hnd->username, optarg, sizeof(fstring)); 00049 else 00050 usage(); 00051 break; 00052 00053 case 'd': /*domain name*/ 00054 case 'w': 00055 case 'W': 00056 if(optarg) 00057 strncpy(hnd->domain, optarg, sizeof(fstring)); 00058 else 00059 usage(); 00060 break; 00061 00062 case 'D': /*debug level*/ 00063 if(optarg) 00064 hnd->debug = atoi(optarg); 00065 else 00066 usage(); 00067 break; 00068 00069 case 'h': /*help*/ 00070 usage(); 00071 break; 00072 00073 case '?': 00074 default: 00075 printf("Unknown option -%c\n", op); 00076 usage(); 00077 } 00078 } 00079 00080 if(optind >= argc) 00081 usage(); 00082 00083 /*whatever is less should be the server*/ 00084 strncpy(hnd->server, argv[optind], sizeof(fstring)); 00085 00086 return 1; 00087 }
|
|
||||||||||||||||||||||||
|
Definition at line 190 of file util.c. References cac_SamGetNamesFromRids(), cac_SamGetRidsFromNames(), False, SamGetNamesFromRids::in, SamGetRidsFromNames::in, line, mgr_getline(), SamGetNamesFromRids::out, SamGetRidsFromNames::out, talloc_strdup(), True, uint32, and ZERO_STRUCT. Referenced by add_user_to_group(), group_menu(), main_menu(), and remove_user_from_group(). 00190 { 00191 fstring line; 00192 00193 BOOL is_rid = False; 00194 uint32 rid_type = 0; 00195 00196 struct SamGetNamesFromRids getnames; 00197 struct SamGetRidsFromNames getrids; 00198 00199 mgr_getline(line); 00200 00201 if(strncmp(line, "0x", 2) == 0) { 00202 /*then this is a RID*/ 00203 sscanf( (line + 2), "%x", rid); 00204 is_rid = True; 00205 } 00206 else { 00207 /*then this is a name*/ 00208 *name = talloc_strdup(mem_ctx, line); 00209 } 00210 00211 if(is_rid) { 00212 ZERO_STRUCT(getnames); 00213 00214 getnames.in.dom_hnd = dom_hnd; 00215 getnames.in.rids = rid; 00216 getnames.in.num_rids = 1; 00217 00218 cac_SamGetNamesFromRids(hnd, mem_ctx, &getnames); 00219 00220 if(getnames.out.num_names > 0) 00221 rid_type = getnames.out.map[0].type; 00222 00223 } 00224 else { 00225 ZERO_STRUCT(getrids); 00226 00227 getrids.in.dom_hnd = dom_hnd; 00228 getrids.in.names = name; 00229 getrids.in.num_names = 1; 00230 00231 cac_SamGetRidsFromNames(hnd, mem_ctx, &getrids); 00232 00233 if(getrids.out.num_rids > 0) { 00234 rid_type = getrids.out.map[0].type; 00235 00236 /*send back the RID so cac_SamOpenXX() doesn't have to look it up*/ 00237 *rid = getrids.out.map[0].rid; 00238 } 00239 } 00240 00241 return rid_type; 00242 }
|
|
|
Definition at line 666 of file smbmount.c. References printf(), and SAMBA_VERSION_STRING. 00667 { 00668 printf("Usage: mount.smbfs service mountpoint [-o options,...]\n"); 00669 00670 printf("Version %s\n\n",SAMBA_VERSION_STRING); 00671 00672 printf("Please be aware that smbfs is deprecated in favor of " 00673 "cifs\n\n"); 00674 00675 printf( 00676 "Options:\n\ 00677 username=<arg> SMB username\n\ 00678 password=<arg> SMB password\n\ 00679 credentials=<filename> file with username/password\n\ 00680 krb use kerberos (active directory)\n\ 00681 netbiosname=<arg> source NetBIOS name\n\ 00682 uid=<arg> mount uid or username\n\ 00683 gid=<arg> mount gid or groupname\n\ 00684 port=<arg> remote SMB port number\n\ 00685 fmask=<arg> file umask\n\ 00686 dmask=<arg> directory umask\n\ 00687 debug=<arg> debug level\n\ 00688 ip=<arg> destination host or IP address\n\ 00689 workgroup=<arg> workgroup on destination\n\ 00690 sockopt=<arg> TCP socket options\n\ 00691 scope=<arg> NetBIOS scope\n\ 00692 iocharset=<arg> Linux charset (iso8859-1, utf8)\n\ 00693 codepage=<arg> server codepage (cp850)\n\ 00694 unicode use unicode when communicating with server\n\ 00695 lfs large file system support\n\ 00696 ttl=<arg> dircache time to live\n\ 00697 guest don't prompt for a password\n\ 00698 ro mount read-only\n\ 00699 rw mount read-write\n\ 00700 \n\ 00701 This command is designed to be run from within /bin/mount by giving\n\ 00702 the option '-t smbfs'. For example:\n\ 00703 mount -t smbfs -o username=tridge,password=foobar //fjall/test /data/test\n\ 00704 "); 00705 }
|
|
||||||||||||||||||||
|
Definition at line 226 of file mgr_user.c. References ACB_DISABLED, add_user_to_group(), cac_SamClose(), cac_SamDeleteUser(), cac_SamDisableUser(), cac_SamEnableUser(), cac_SamGetGroupsForUser(), cac_SamGetNamesFromRids(), cac_SamGetUserInfo(), cac_SamSetPassword(), get_new_password(), SamRemoveGroupMember::in, SamGetUserInfo::in, SamGetGroupsForUser::in, SamGetNamesFromRids::in, SamSetPassword::in, list_groups(), mgr_getline(), modify_user_info(), SamGetUserInfo::out, SamGetGroupsForUser::out, SamGetNamesFromRids::out, print_lookup_records(), print_user_info(), printerr(), printf(), remove_user_from_group(), _CACSERVERHANDLE::status, and ZERO_STRUCT. Referenced by create_menu(), and main_menu(). 00226 { 00227 fstring in; 00228 00229 struct SamGetUserInfo getinfo; 00230 struct SamSetPassword setpass; 00231 struct SamGetGroupsForUser groups; 00232 struct SamGetNamesFromRids gnfr; 00233 00234 CacUserInfo *info = NULL; 00235 00236 if(!hnd || !mem_ctx || !user_hnd) { 00237 printf("Must open user.\n"); 00238 return; 00239 } 00240 00241 /*get the userinfo and print it out*/ 00242 ZERO_STRUCT(getinfo); 00243 getinfo.in.user_hnd = user_hnd; 00244 00245 if(!cac_SamGetUserInfo(hnd, mem_ctx, &getinfo)) { 00246 printerr("Could not get info.", hnd->status); 00247 info = NULL; 00248 } 00249 else { 00250 info = getinfo.out.info; 00251 print_user_info(info); 00252 } 00253 00254 /*now deal with the menu*/ 00255 in[0] = '\0'; 00256 while(in[0] != 'b' && in[0] != 'B' && in[0] != 'q' && in[0] != 'Q') { 00257 printf("\n"); 00258 printf("[s] Set Password\n"); 00259 00260 if(info && (info->acb_mask & ACB_DISABLED)) 00261 printf("[e] Enable User\n"); 00262 else if(info) 00263 printf("[d] Disable User\n"); 00264 00265 printf("[v] View User Info\n"); 00266 printf("[m] Modify User Info\n"); 00267 printf("[x] Delete User\n\n"); 00268 00269 printf("[g] List Group Membership\n"); 00270 printf("[a] Add User To Group\n"); 00271 printf("[l] List Domain Groups\n"); 00272 printf("[r] Remove User From Group\n\n"); 00273 00274 printf("[b] Back\n\n"); 00275 00276 printf("Command: "); 00277 mgr_getline(in); 00278 00279 printf("\n"); 00280 00281 switch(in[0]) { 00282 case 'g': /*list group membership*/ 00283 case 'G': 00284 ZERO_STRUCT(groups); 00285 groups.in.user_hnd = user_hnd; 00286 00287 if(!cac_SamGetGroupsForUser(hnd, mem_ctx, &groups)) { 00288 printerr("Could not get groups.", hnd->status); 00289 break; 00290 } 00291 00292 ZERO_STRUCT(gnfr); 00293 gnfr.in.dom_hnd = dom_hnd; 00294 gnfr.in.rids = groups.out.rids; 00295 gnfr.in.num_rids = groups.out.num_groups; 00296 00297 if(!cac_SamGetNamesFromRids(hnd, mem_ctx, &gnfr)) { 00298 printerr("Could not map RIDs to names.", hnd->status); 00299 break; 00300 } 00301 00302 print_lookup_records(gnfr.out.map, gnfr.out.num_names); 00303 00304 break; 00305 case 's': /*reset password*/ 00306 case 'S': 00307 ZERO_STRUCT(setpass); 00308 setpass.in.user_hnd = user_hnd; 00309 setpass.in.password = get_new_password(mem_ctx); 00310 00311 if(!setpass.in.password) { 00312 printf("Out of memory.\n"); 00313 break; 00314 } 00315 00316 if(!cac_SamSetPassword(hnd, mem_ctx, &setpass)) { 00317 printerr("Could not set password.", hnd->status); 00318 } 00319 else { 00320 printf("Reset password.\n"); 00321 } 00322 break; 00323 00324 case 'e': /*enable user*/ 00325 case 'E': 00326 if(info && !(info->acb_mask & ACB_DISABLED)) 00327 break; 00328 00329 if(!cac_SamEnableUser(hnd, mem_ctx, user_hnd)) { 00330 printerr("Could not enable user.", hnd->status); 00331 } 00332 else { 00333 printf("Enabled User.\n"); 00334 /*toggle the disabled ACB bit in our local copy of the info*/ 00335 info->acb_mask ^= ACB_DISABLED; 00336 } 00337 break; 00338 00339 case 'd': /*disable user*/ 00340 case 'D': 00341 if(info && (info->acb_mask & ACB_DISABLED)) 00342 break; 00343 00344 if(!cac_SamDisableUser(hnd, mem_ctx, user_hnd)) { 00345 printerr("Could not disable user.", hnd->status); 00346 } 00347 else { 00348 printf("Disabled User.\n"); 00349 /*toggle the disabled ACB bit in our local copy of the info*/ 00350 info->acb_mask ^= ACB_DISABLED; 00351 } 00352 break; 00353 00354 case 'v': /*view user info*/ 00355 case 'V': 00356 ZERO_STRUCT(getinfo); 00357 getinfo.in.user_hnd = user_hnd; 00358 00359 if(!cac_SamGetUserInfo(hnd, mem_ctx, &getinfo)) { 00360 printerr("Could not get info.", hnd->status); 00361 info = NULL; 00362 } 00363 else { 00364 info = getinfo.out.info; 00365 print_user_info(info); 00366 } 00367 00368 break; 00369 00370 case 'm': /*modify user info*/ 00371 case 'M': 00372 info = modify_user_info(hnd, mem_ctx, user_hnd); 00373 00374 if(info) 00375 printf("Updated user info.\n"); 00376 break; 00377 00378 case 'l': /*list domain groups*/ 00379 case 'L': 00380 list_groups(hnd, mem_ctx, dom_hnd); 00381 break; 00382 00383 case 'a': /*add user to group*/ 00384 case 'A': 00385 add_user_to_group(hnd, mem_ctx, info, dom_hnd); 00386 break; 00387 00388 case 'r': /*remove user from group*/ 00389 case 'R': 00390 remove_user_from_group(hnd, mem_ctx, info, dom_hnd); 00391 break; 00392 00393 case 'x': /*delete user*/ 00394 case 'X': 00395 if(!cac_SamDeleteUser(hnd, mem_ctx, user_hnd)) 00396 printerr("Could not delete user.", hnd->status); 00397 00398 /*we want to go back to the main menu*/ 00399 in[0] = 'b'; 00400 break; 00401 00402 case 'b': /*back*/ 00403 case 'B': 00404 case 'q': 00405 case 'Q': 00406 /*do nothing*/ 00407 break; 00408 00409 default: 00410 printf("Invalid command.\n"); 00411 } 00412 } 00413 00414 /*close the user before returning*/ 00415 cac_SamClose(hnd, mem_ctx, user_hnd); 00416 }
|