関数 | |
| uint32 | get_sec_channel_type (const char *param) |
| int | net_run_function (int argc, const char **argv, struct functable *table, int(*usage_fn)(int argc, const char **argv)) |
| int | net_run_function2 (int argc, const char **argv, const char *whoami, struct functable2 *table) |
| NTSTATUS | connect_to_service (struct cli_state **c, struct in_addr *server_ip, const char *server_name, const char *service_name, const char *service_type) |
| NTSTATUS | connect_to_ipc (struct cli_state **c, struct in_addr *server_ip, const char *server_name) |
| NTSTATUS | connect_to_ipc_anonymous (struct cli_state **c, struct in_addr *server_ip, const char *server_name) |
| static char * | get_user_and_realm (const char *username) |
| NTSTATUS | connect_to_ipc_krb5 (struct cli_state **c, struct in_addr *server_ip, const char *server_name) |
| NTSTATUS | connect_dst_pipe (struct cli_state **cli_dst, struct rpc_pipe_client **pp_pipe_hnd, int pipe_num) |
| Connect a server and open a given pipe | |
| int | net_use_krb_machine_account (void) |
| int | net_use_machine_account (void) |
| BOOL | net_find_server (const char *domain, unsigned flags, struct in_addr *server_ip, char **server_name) |
| BOOL | net_find_pdc (struct in_addr *server_ip, fstring server_name, const char *domain_name) |
| cli_state * | net_make_ipc_connection (unsigned flags) |
| cli_state * | net_make_ipc_connection_ex (const char *domain, const char *server, struct in_addr *ip, unsigned flags) |
| static int | net_user (int argc, const char **argv) |
| static int | net_group (int argc, const char **argv) |
| static int | net_join (int argc, const char **argv) |
| static int | net_changetrustpw (int argc, const char **argv) |
| static void | set_line_buffering (FILE *f) |
| static int | net_changesecretpw (int argc, const char **argv) |
| static int | net_share (int argc, const char **argv) |
| static int | net_file (int argc, const char **argv) |
| static int | net_getlocalsid (int argc, const char **argv) |
| static int | net_setlocalsid (int argc, const char **argv) |
| static int | net_setdomainsid (int argc, const char **argv) |
| static int | net_getdomainsid (int argc, const char **argv) |
| int | net_help_afs (int argc, const char **argv) |
| static int | net_afs_key (int argc, const char **argv) |
| static int | net_afs_impersonate (int argc, const char **argv) |
| static int | net_afs (int argc, const char **argv) |
| static BOOL | search_maxrid (struct pdb_search *search, const char *type, uint32 *max_rid) |
| static uint32 | get_maxrid (void) |
| static int | net_maxrid (int argc, const char **argv) |
| int | main (int argc, const char **argv) |
変数 | |
| const char * | opt_requester_name = NULL |
| const char * | opt_host = NULL |
| const char * | opt_password = NULL |
| const char * | opt_user_name = NULL |
| BOOL | opt_user_specified = False |
| const char * | opt_workgroup = NULL |
| int | opt_long_list_entries = 0 |
| int | opt_reboot = 0 |
| int | opt_force = 0 |
| int | opt_stdin = 0 |
| int | opt_port = 0 |
| int | opt_verbose = 0 |
| int | opt_maxusers = -1 |
| const char * | opt_comment = "" |
| const char * | opt_container = NULL |
| int | opt_flags = -1 |
| int | opt_timeout = 0 |
| const char * | opt_target_workgroup = NULL |
| int | opt_machine_pass = 0 |
| BOOL | opt_localgroup = False |
| BOOL | opt_domaingroup = False |
| static BOOL | do_talloc_report = False |
| const char * | opt_newntname = "" |
| int | opt_rid = 0 |
| int | opt_acls = 0 |
| int | opt_attrs = 0 |
| int | opt_timestamps = 0 |
| const char * | opt_exclude = NULL |
| const char * | opt_destination = NULL |
| BOOL | opt_have_ip = False |
| in_addr | opt_dest_ip |
| in_addr | loopback_ip |
| BOOL | AllowDebugChange |
| static struct functable | net_func [] |
| uint32 get_sec_channel_type | ( | const char * | param | ) |
参照先 get_default_sec_channel()・SEC_CHAN_BDC・SEC_CHAN_DOMAIN・SEC_CHAN_WKSTA・strequal().
参照元 net_rpc_join_newstyle()・rpc_oldjoin_internals().
00096 { 00097 if (!(param && *param)) { 00098 return get_default_sec_channel(); 00099 } else { 00100 if (strequal(param, "PDC")) { 00101 return SEC_CHAN_BDC; 00102 } else if (strequal(param, "BDC")) { 00103 return SEC_CHAN_BDC; 00104 } else if (strequal(param, "MEMBER")) { 00105 return SEC_CHAN_WKSTA; 00106 #if 0 00107 } else if (strequal(param, "DOMAIN")) { 00108 return SEC_CHAN_DOMAIN; 00109 #endif 00110 } else { 00111 return get_default_sec_channel(); 00112 } 00113 } 00114 }
| int net_run_function | ( | int | argc, | |
| const char ** | argv, | |||
| struct functable * | table, | |||
| int(*)(int argc, const char **argv) | usage_fn | |||
| ) |
参照先 d_fprintf()・d_printf()・fn・StrCaseCmp().
参照元 main()・net_ads()・net_ads_dns()・net_ads_gpo()・net_ads_group()・net_ads_help()・net_ads_keytab()・net_ads_printer()・net_ads_user()・net_afs()・net_cache()・net_groupmap()・net_help()・net_idmap()・net_rap()・net_rap_file()・net_rap_group()・net_rap_groupmember()・net_rap_help()・net_rap_printq()・net_rap_service()・net_rap_session()・net_rap_share()・net_rap_user()・net_rpc()・net_rpc_audit()・net_rpc_file()・net_rpc_group()・net_rpc_help()・net_rpc_printer()・net_rpc_registry()・net_rpc_rights()・net_rpc_service()・net_rpc_share()・net_rpc_user()・net_status()・net_time()・net_usershare()・net_usershare_help()・rpc_printer_migrate()・rpc_printer_publish()・rpc_share_migrate()・rpc_trustdom().
00122 { 00123 int i; 00124 00125 if (argc < 1) { 00126 d_printf("\nUsage: \n"); 00127 return usage_fn(argc, argv); 00128 } 00129 for (i=0; table[i].funcname; i++) { 00130 if (StrCaseCmp(argv[0], table[i].funcname) == 0) 00131 return table[i].fn(argc-1, argv+1); 00132 } 00133 d_fprintf(stderr, "No command: %s\n", argv[0]); 00134 return usage_fn(argc, argv); 00135 }
| int net_run_function2 | ( | int | argc, | |
| const char ** | argv, | |||
| const char * | whoami, | |||
| struct functable2 * | table | |||
| ) |
参照先 d_printf()・fn・StrCaseCmp().
参照元 net_sam()・net_sam_list()・net_sam_policy()・net_sam_set().
00142 { 00143 int i; 00144 00145 if (argc != 0) { 00146 for (i=0; table[i].funcname; i++) { 00147 if (StrCaseCmp(argv[0], table[i].funcname) == 0) 00148 return table[i].fn(argc-1, argv+1); 00149 } 00150 } 00151 00152 for (i=0; table[i].funcname != NULL; i++) { 00153 d_printf("%s %-15s %s\n", whoami, table[i].funcname, 00154 table[i].helptext); 00155 } 00156 00157 return -1; 00158 }
| NTSTATUS connect_to_service | ( | struct cli_state ** | c, | |
| struct in_addr * | server_ip, | |||
| const char * | server_name, | |||
| const char * | service_name, | |||
| const char * | service_type | |||
| ) |
参照先 c・cli_full_connection()・d_fprintf()・opt_machine_pass・opt_password・opt_port・opt_user_name・opt_workgroup.
参照元 connect_to_ipc()・rpc_printer_migrate_drivers_internals()・rpc_share_migrate_files_internals().
00168 { 00169 NTSTATUS nt_status; 00170 00171 if (!opt_password && !opt_machine_pass) { 00172 char *pass = getpass("Password:"); 00173 if (pass) { 00174 opt_password = SMB_STRDUP(pass); 00175 } 00176 } 00177 00178 nt_status = cli_full_connection(c, NULL, server_name, 00179 server_ip, opt_port, 00180 service_name, service_type, 00181 opt_user_name, opt_workgroup, 00182 opt_password, 0, Undefined, NULL); 00183 00184 if (NT_STATUS_IS_OK(nt_status) || 00185 NT_STATUS_EQUAL(nt_status, NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT) || 00186 NT_STATUS_EQUAL(nt_status, NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT) || 00187 NT_STATUS_EQUAL(nt_status, NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT)) { 00188 return nt_status; 00189 } 00190 00191 d_fprintf(stderr, "Could not connect to server %s\n", server_name); 00192 00193 /* Display a nicer message depending on the result */ 00194 00195 if (NT_STATUS_V(nt_status) == 00196 NT_STATUS_V(NT_STATUS_LOGON_FAILURE)) 00197 d_fprintf(stderr, "The username or password was not correct.\n"); 00198 00199 if (NT_STATUS_V(nt_status) == 00200 NT_STATUS_V(NT_STATUS_ACCOUNT_LOCKED_OUT)) 00201 d_fprintf(stderr, "The account was locked out.\n"); 00202 00203 if (NT_STATUS_V(nt_status) == 00204 NT_STATUS_V(NT_STATUS_ACCOUNT_DISABLED)) 00205 d_fprintf(stderr, "The account was disabled.\n"); 00206 00207 return nt_status; 00208 }
| NTSTATUS connect_to_ipc | ( | struct cli_state ** | c, | |
| struct in_addr * | server_ip, | |||
| const char * | server_name | |||
| ) |
参照先 c・connect_to_service().
参照元 connect_dst_pipe()・net_make_ipc_connection_ex()・rpc_trustdom_establish().
00216 { 00217 return connect_to_service(c, server_ip, server_name, "IPC$", "IPC"); 00218 }
| NTSTATUS connect_to_ipc_anonymous | ( | struct cli_state ** | c, | |
| struct in_addr * | server_ip, | |||
| const char * | server_name | |||
| ) |
参照先 c・cli_full_connection()・nt_errstr()・opt_port・opt_requester_name.
参照元 net_make_ipc_connection_ex()・rpc_trustdom_establish().
00225 { 00226 NTSTATUS nt_status; 00227 00228 nt_status = cli_full_connection(c, opt_requester_name, server_name, 00229 server_ip, opt_port, 00230 "IPC$", "IPC", 00231 "", "", 00232 "", 0, Undefined, NULL); 00233 00234 if (NT_STATUS_IS_OK(nt_status)) { 00235 return nt_status; 00236 } else { 00237 DEBUG(1,("Cannot connect to server (anonymously). Error was %s\n", nt_errstr(nt_status))); 00238 return nt_status; 00239 } 00240 }
| static char* get_user_and_realm | ( | const char * | username | ) | [static] |
参照先 asprintf()・strchr_m().
00247 { 00248 char *user_and_realm = NULL; 00249 00250 if (!username) { 00251 return NULL; 00252 } 00253 if (strchr_m(username, '@')) { 00254 user_and_realm = SMB_STRDUP(username); 00255 } else { 00256 if (asprintf(&user_and_realm, "%s@%s", username, lp_realm()) == -1) { 00257 user_and_realm = NULL; 00258 } 00259 } 00260 return user_and_realm; 00261 }
| NTSTATUS connect_to_ipc_krb5 | ( | struct cli_state ** | c, | |
| struct in_addr * | server_ip, | |||
| const char * | server_name | |||
| ) |
参照先 c・cli_full_connection()・get_user_and_realm()・nt_errstr()・opt_machine_pass・opt_password・opt_port・opt_user_name・opt_workgroup.
参照元 net_ads_leave()・net_join_domain().
00269 { 00270 NTSTATUS nt_status; 00271 char *user_and_realm = NULL; 00272 00273 if (!opt_password && !opt_machine_pass) { 00274 char *pass = getpass("Password:"); 00275 if (pass) { 00276 opt_password = SMB_STRDUP(pass); 00277 } 00278 } 00279 00280 user_and_realm = get_user_and_realm(opt_user_name); 00281 if (!user_and_realm) { 00282 return NT_STATUS_NO_MEMORY; 00283 } 00284 00285 nt_status = cli_full_connection(c, NULL, server_name, 00286 server_ip, opt_port, 00287 "IPC$", "IPC", 00288 user_and_realm, opt_workgroup, 00289 opt_password, CLI_FULL_CONNECTION_USE_KERBEROS, 00290 Undefined, NULL); 00291 00292 SAFE_FREE(user_and_realm); 00293 00294 if (NT_STATUS_IS_OK(nt_status)) { 00295 return nt_status; 00296 } else { 00297 DEBUG(1,("Cannot connect to server using kerberos. Error was %s\n", nt_errstr(nt_status))); 00298 return nt_status; 00299 } 00300 }
| NTSTATUS connect_dst_pipe | ( | struct cli_state ** | cli_dst, | |
| struct rpc_pipe_client ** | pp_pipe_hnd, | |||
| int | pipe_num | |||
| ) |
Connect a server and open a given pipe
| cli_dst | A cli_state | |
| pipe | The pipe to open | |
| got_pipe | boolean that stores if we got a pipe |
参照先 cli_rpc_pipe_open_noauth()・cli_shutdown()・connect_to_ipc()・opt_destination.
参照元 rpc_printer_migrate_drivers_internals()・rpc_printer_migrate_forms_internals()・rpc_printer_migrate_printers_internals()・rpc_printer_migrate_security_internals()・rpc_printer_migrate_settings_internals()・rpc_share_migrate_security_internals()・rpc_share_migrate_shares_internals().
00312 { 00313 NTSTATUS nt_status; 00314 char *server_name = SMB_STRDUP("127.0.0.1"); 00315 struct cli_state *cli_tmp = NULL; 00316 struct rpc_pipe_client *pipe_hnd = NULL; 00317 00318 if (server_name == NULL) { 00319 return NT_STATUS_NO_MEMORY; 00320 } 00321 00322 if (opt_destination) { 00323 SAFE_FREE(server_name); 00324 if ((server_name = SMB_STRDUP(opt_destination)) == NULL) { 00325 return NT_STATUS_NO_MEMORY; 00326 } 00327 } 00328 00329 /* make a connection to a named pipe */ 00330 nt_status = connect_to_ipc(&cli_tmp, NULL, server_name); 00331 if (!NT_STATUS_IS_OK(nt_status)) { 00332 SAFE_FREE(server_name); 00333 return nt_status; 00334 } 00335 00336 pipe_hnd = cli_rpc_pipe_open_noauth(cli_tmp, pipe_num, &nt_status); 00337 if (!pipe_hnd) { 00338 DEBUG(0, ("couldn't not initialize pipe\n")); 00339 cli_shutdown(cli_tmp); 00340 SAFE_FREE(server_name); 00341 return nt_status; 00342 } 00343 00344 *cli_dst = cli_tmp; 00345 *pp_pipe_hnd = pipe_hnd; 00346 SAFE_FREE(server_name); 00347 00348 return nt_status; 00349 }
| int net_use_krb_machine_account | ( | void | ) |
参照先 asprintf()・d_fprintf()・global_myname・opt_password・opt_target_workgroup・opt_user_name・secrets_fetch_machine_password()・secrets_init()・user_name.
参照元 main()・net_ads_changetrustpw()・net_ads_join_ok().
00356 { 00357 char *user_name = NULL; 00358 00359 if (!secrets_init()) { 00360 d_fprintf(stderr, "ERROR: Unable to open secrets database\n"); 00361 exit(1); 00362 } 00363 00364 opt_password = secrets_fetch_machine_password(opt_target_workgroup, NULL, NULL); 00365 if (asprintf(&user_name, "%s$@%s", global_myname(), lp_realm()) == -1) { 00366 return -1; 00367 } 00368 opt_user_name = user_name; 00369 return 0; 00370 }
| int net_use_machine_account | ( | void | ) |
参照先 asprintf()・d_fprintf()・global_myname・opt_password・opt_target_workgroup・opt_user_name・secrets_fetch_machine_password()・secrets_init()・user_name.
参照元 net_rpc_changetrustpw()・net_rpc_join_ok().
00377 { 00378 char *user_name = NULL; 00379 00380 if (!secrets_init()) { 00381 d_fprintf(stderr, "ERROR: Unable to open secrets database\n"); 00382 exit(1); 00383 } 00384 00385 opt_password = secrets_fetch_machine_password(opt_target_workgroup, NULL, NULL); 00386 if (asprintf(&user_name, "%s$", global_myname()) == -1) { 00387 return -1; 00388 } 00389 opt_user_name = user_name; 00390 return 0; 00391 }
| BOOL net_find_server | ( | const char * | domain, | |
| unsigned | flags, | |||
| struct in_addr * | server_ip, | |||
| char ** | server_name | |||
| ) |
参照先 get_pdc_ip()・is_zero_ip()・loopback_ip・name_status_find()・opt_dest_ip・opt_have_ip・opt_host・opt_target_workgroup・resolve_name().
参照元 net_make_ipc_connection_ex()・net_rpc_check().
00394 { 00395 const char *d = domain ? domain : opt_target_workgroup; 00396 00397 if (opt_host) { 00398 *server_name = SMB_STRDUP(opt_host); 00399 } 00400 00401 if (opt_have_ip) { 00402 *server_ip = opt_dest_ip; 00403 if (!*server_name) { 00404 *server_name = SMB_STRDUP(inet_ntoa(opt_dest_ip)); 00405 } 00406 } else if (*server_name) { 00407 /* resolve the IP address */ 00408 if (!resolve_name(*server_name, server_ip, 0x20)) { 00409 DEBUG(1,("Unable to resolve server name\n")); 00410 return False; 00411 } 00412 } else if (flags & NET_FLAGS_PDC) { 00413 struct in_addr pdc_ip; 00414 00415 if (get_pdc_ip(d, &pdc_ip)) { 00416 fstring dc_name; 00417 00418 if (is_zero_ip(pdc_ip)) 00419 return False; 00420 00421 if ( !name_status_find(d, 0x1b, 0x20, pdc_ip, dc_name) ) 00422 return False; 00423 00424 *server_name = SMB_STRDUP(dc_name); 00425 *server_ip = pdc_ip; 00426 } 00427 } else if (flags & NET_FLAGS_DMB) { 00428 struct in_addr msbrow_ip; 00429 /* if (!resolve_name(MSBROWSE, &msbrow_ip, 1)) */ 00430 if (!resolve_name(d, &msbrow_ip, 0x1B)) { 00431 DEBUG(1,("Unable to resolve domain browser via name lookup\n")); 00432 return False; 00433 } else { 00434 *server_ip = msbrow_ip; 00435 } 00436 *server_name = SMB_STRDUP(inet_ntoa(opt_dest_ip)); 00437 } else if (flags & NET_FLAGS_MASTER) { 00438 struct in_addr brow_ips; 00439 if (!resolve_name(d, &brow_ips, 0x1D)) { 00440 /* go looking for workgroups */ 00441 DEBUG(1,("Unable to resolve master browser via name lookup\n")); 00442 return False; 00443 } else { 00444 *server_ip = brow_ips; 00445 } 00446 *server_name = SMB_STRDUP(inet_ntoa(opt_dest_ip)); 00447 } else if (!(flags & NET_FLAGS_LOCALHOST_DEFAULT_INSANE)) { 00448 *server_ip = loopback_ip; 00449 *server_name = SMB_STRDUP("127.0.0.1"); 00450 } 00451 00452 if (!server_name || !*server_name) { 00453 DEBUG(1,("no server to connect to\n")); 00454 return False; 00455 } 00456 00457 return True; 00458 }
参照先 get_pdc_ip()・is_zero_ip()・name_status_find().
00462 { 00463 if (get_pdc_ip(domain_name, server_ip)) { 00464 if (is_zero_ip(*server_ip)) 00465 return False; 00466 00467 if (!name_status_find(domain_name, 0x1b, 0x20, *server_ip, server_name)) 00468 return False; 00469 00470 return True; 00471 } 00472 else 00473 return False; 00474 }
| struct cli_state* net_make_ipc_connection | ( | unsigned | flags | ) |
参照先 net_make_ipc_connection_ex().
参照元 net_rap_domain()・net_rap_file()・net_rap_group()・net_rap_password()・net_rap_printq()・net_rap_server()・net_rap_server_name()・net_rap_service()・net_rap_session()・net_rap_share()・net_rap_user()・net_rpc_join_newstyle()・net_rpc_shell()・rap_file_close()・rap_file_info()・rap_group_add()・rap_group_delete()・rap_groupmember_add()・rap_groupmember_delete()・rap_groupmember_list()・rap_printq_delete()・rap_printq_info()・rap_session_delete()・rap_session_info()・rap_share_add()・rap_share_delete()・rap_user_add()・rap_user_delete()・rap_user_info()・rpc_trustdom_list()・rpc_trustdom_vampire()・run_rpc_command().
00477 { 00478 return net_make_ipc_connection_ex( NULL, NULL, NULL, flags ); 00479 }
| struct cli_state* net_make_ipc_connection_ex | ( | const char * | domain, | |
| const char * | server, | |||
| struct in_addr * | ip, | |||
| unsigned | flags | |||
| ) |
参照先 cli・connect_to_ipc()・connect_to_ipc_anonymous()・d_fprintf()・cli_state::desthost・net_find_server()・nt_errstr()・opt_user_name・saf_store()・cli_state::server_domain.
参照元 net_make_ipc_connection()・net_rpc_join_ok().
00483 { 00484 char *server_name = NULL; 00485 struct in_addr server_ip; 00486 struct cli_state *cli = NULL; 00487 NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL; 00488 00489 if ( !server || !ip ) { 00490 if (!net_find_server(domain, flags, &server_ip, &server_name)) { 00491 d_fprintf(stderr, "Unable to find a suitable server\n"); 00492 return NULL; 00493 } 00494 } else { 00495 server_name = SMB_STRDUP( server ); 00496 server_ip = *ip; 00497 } 00498 00499 if (opt_user_name) { 00500 nt_status = connect_to_ipc(&cli, &server_ip, server_name); 00501 if (NT_STATUS_IS_OK(nt_status)) { 00502 goto connected; 00503 } 00504 } 00505 if (flags & NET_FLAGS_ANONYMOUS) { 00506 nt_status = connect_to_ipc_anonymous(&cli, &server_ip, server_name); 00507 if (NT_STATUS_IS_OK(nt_status)) { 00508 goto connected; 00509 } 00510 } 00511 00512 SAFE_FREE(server_name); 00513 d_fprintf(stderr, "Connection failed: %s\n", 00514 nt_errstr(nt_status)); 00515 return NULL; 00516 00517 connected: 00518 /* store the server in the affinity cache if it was a PDC */ 00519 00520 if ( (flags & NET_FLAGS_PDC) && NT_STATUS_IS_OK(nt_status) ) 00521 saf_store( cli->server_domain, cli->desthost ); 00522 00523 return cli; 00524 }
| static int net_user | ( | int | argc, | |
| const char ** | argv | |||
| ) | [static] |
参照先 net_ads_check()・net_ads_user()・net_rap_user()・net_rpc_check()・net_rpc_user().
00527 { 00528 if (net_ads_check() == 0) 00529 return net_ads_user(argc, argv); 00530 00531 /* if server is not specified, default to PDC? */ 00532 if (net_rpc_check(NET_FLAGS_PDC)) 00533 return net_rpc_user(argc, argv); 00534 00535 return net_rap_user(argc, argv); 00536 }
| static int net_group | ( | int | argc, | |
| const char ** | argv | |||
| ) | [static] |
参照先 net_ads_check()・net_ads_group()・net_rap_group()・net_rpc_check()・net_rpc_group().
00539 { 00540 if (net_ads_check() == 0) 00541 return net_ads_group(argc, argv); 00542 00543 if (argc == 0 && net_rpc_check(NET_FLAGS_PDC)) 00544 return net_rpc_group(argc, argv); 00545 00546 return net_rap_group(argc, argv); 00547 }
| static int net_join | ( | int | argc, | |
| const char ** | argv | |||
| ) | [static] |
参照先 d_fprintf()・net_ads_check_our_domain()・net_ads_join()・net_rpc_join().
00550 { 00551 if (net_ads_check_our_domain() == 0) { 00552 if (net_ads_join(argc, argv) == 0) 00553 return 0; 00554 else 00555 d_fprintf(stderr, "ADS join did not work, falling back to RPC...\n"); 00556 } 00557 return net_rpc_join(argc, argv); 00558 }
| static int net_changetrustpw | ( | int | argc, | |
| const char ** | argv | |||
| ) | [static] |
参照先 net_ads_changetrustpw()・net_ads_check_our_domain()・net_rpc_changetrustpw().
00561 { 00562 if (net_ads_check_our_domain() == 0) 00563 return net_ads_changetrustpw(argc, argv); 00564 00565 return net_rpc_changetrustpw(argc, argv); 00566 }
| static void set_line_buffering | ( | FILE * | f | ) | [static] |
| static int net_changesecretpw | ( | int | argc, | |
| const char ** | argv | |||
| ) | [static] |
参照先 d_fprintf()・d_printf()・get_pass()・lp_workgroup()・opt_force・opt_stdin・SEC_CHAN_WKSTA・secrets_store_machine_password()・set_line_buffering().
00574 { 00575 char *trust_pw; 00576 uint32 sec_channel_type = SEC_CHAN_WKSTA; 00577 00578 if(opt_force) { 00579 if (opt_stdin) { 00580 set_line_buffering(stdin); 00581 set_line_buffering(stdout); 00582 set_line_buffering(stderr); 00583 } 00584 00585 trust_pw = get_pass("Enter machine password: ", opt_stdin); 00586 00587 if (!secrets_store_machine_password(trust_pw, lp_workgroup(), sec_channel_type)) { 00588 d_fprintf(stderr, "Unable to write the machine account password in the secrets database"); 00589 return 1; 00590 } 00591 else { 00592 d_printf("Modified trust account password in secrets database\n"); 00593 } 00594 } 00595 else { 00596 d_printf("Machine account password change requires the -f flag.\n"); 00597 d_printf("Do NOT use this function unless you know what it does!\n"); 00598 d_printf("This function will change the ADS Domain member machine account password in the secrets.tdb file!\n"); 00599 } 00600 00601 return 0; 00602 }
| static int net_share | ( | int | argc, | |
| const char ** | argv | |||
| ) | [static] |
参照先 net_rap_share()・net_rpc_check()・net_rpc_share().
00605 { 00606 if (net_rpc_check(0)) 00607 return net_rpc_share(argc, argv); 00608 return net_rap_share(argc, argv); 00609 }
| static int net_file | ( | int | argc, | |
| const char ** | argv | |||
| ) | [static] |
参照先 net_rap_file()・net_rpc_check()・net_rpc_file().
00612 { 00613 if (net_rpc_check(0)) 00614 return net_rpc_file(argc, argv); 00615 return net_rap_file(argc, argv); 00616 }
| static int net_getlocalsid | ( | int | argc, | |
| const char ** | argv | |||
| ) | [static] |
参照先 d_fprintf()・d_printf()・get_global_sam_sid()・global_myname・initialize_password_db()・name・secrets_fetch_domain_sid()・secrets_init()・sid_to_string().
00622 { 00623 DOM_SID sid; 00624 const char *name; 00625 fstring sid_str; 00626 00627 if (argc >= 1) { 00628 name = argv[0]; 00629 } 00630 else { 00631 name = global_myname(); 00632 } 00633 00634 if(!initialize_password_db(False)) { 00635 DEBUG(0, ("WARNING: Could not open passdb - local sid may not reflect passdb\n" 00636 "backend knowlege (such as the sid stored in LDAP)\n")); 00637 } 00638 00639 /* first check to see if we can even access secrets, so we don't 00640 panic when we can't. */ 00641 00642 if (!secrets_init()) { 00643 d_fprintf(stderr, "Unable to open secrets.tdb. Can't fetch domain SID for name: %s\n", name); 00644 return 1; 00645 } 00646 00647 /* Generate one, if it doesn't exist */ 00648 get_global_sam_sid(); 00649 00650 if (!secrets_fetch_domain_sid(name, &sid)) { 00651 DEBUG(0, ("Can't fetch domain SID for name: %s\n", name)); 00652 return 1; 00653 } 00654 sid_to_string(sid_str, &sid); 00655 d_printf("SID for domain %s is: %s\n", name, sid_str); 00656 return 0; 00657 }
| static int net_setlocalsid | ( | int | argc, | |
| const char ** | argv | |||
| ) | [static] |
参照先 d_printf()・global_myname・dom_sid::num_auths・secrets_store_domain_sid()・string_to_sid().
00660 { 00661 DOM_SID sid; 00662 00663 if ( (argc != 1) 00664 || (strncmp(argv[0], "S-1-5-21-", strlen("S-1-5-21-")) != 0) 00665 || (!string_to_sid(&sid, argv[0])) 00666 || (sid.num_auths != 4)) { 00667 d_printf("usage: net setlocalsid S-1-5-21-x-y-z\n"); 00668 return 1; 00669 } 00670 00671 if (!secrets_store_domain_sid(global_myname(), &sid)) { 00672 DEBUG(0,("Can't store domain SID as a pdc/bdc.\n")); 00673 return 1; 00674 } 00675 00676 return 0; 00677 }
| static int net_setdomainsid | ( | int | argc, | |
| const char ** | argv | |||
| ) | [static] |
参照先 d_printf()・lp_workgroup()・dom_sid::num_auths・secrets_store_domain_sid()・string_to_sid().
00680 { 00681 DOM_SID sid; 00682 00683 if ( (argc != 1) 00684 || (strncmp(argv[0], "S-1-5-21-", strlen("S-1-5-21-")) != 0) 00685 || (!string_to_sid(&sid, argv[0])) 00686 || (sid.num_auths != 4)) { 00687 d_printf("usage: net setdomainsid S-1-5-21-x-y-z\n"); 00688 return 1; 00689 } 00690 00691 if (!secrets_store_domain_sid(lp_workgroup(), &sid)) { 00692 DEBUG(0,("Can't store domain SID.\n")); 00693 return 1; 00694 } 00695 00696 return 0; 00697 }
| static int net_getdomainsid | ( | int | argc, | |
| const char ** | argv | |||
| ) | [static] |
参照先 d_fprintf()・d_printf()・domain_sid・get_global_sam_name()・get_global_sam_sid()・global_myname・initialize_password_db()・opt_workgroup・secrets_fetch_domain_sid()・secrets_init()・sid_to_string().
00700 { 00701 DOM_SID domain_sid; 00702 fstring sid_str; 00703 00704 if(!initialize_password_db(False)) { 00705 DEBUG(0, ("WARNING: Could not open passdb - domain sid may not reflect passdb\n" 00706 "backend knowlege (such as the sid stored in LDAP)\n")); 00707 } 00708 00709 /* first check to see if we can even access secrets, so we don't 00710 panic when we can't. */ 00711 00712 if (!secrets_init()) { 00713 d_fprintf(stderr, "Unable to open secrets.tdb. " 00714 "Can't fetch domainSID for name: %s\n", 00715 get_global_sam_name()); 00716 return 1; 00717 } 00718 00719 /* Generate one, if it doesn't exist */ 00720 get_global_sam_sid(); 00721 00722 if (!secrets_fetch_domain_sid(global_myname(), &domain_sid)) { 00723 d_fprintf(stderr, "Could not fetch local SID\n"); 00724 return 1; 00725 } 00726 sid_to_string(sid_str, &domain_sid); 00727 d_printf("SID for domain %s is: %s\n", global_myname(), sid_str); 00728 00729 if (!secrets_fetch_domain_sid(opt_workgroup, &domain_sid)) { 00730 d_fprintf(stderr, "Could not fetch domain SID\n"); 00731 return 1; 00732 } 00733 00734 sid_to_string(sid_str, &domain_sid); 00735 d_printf("SID for domain %s is: %s\n", opt_workgroup, sid_str); 00736 00737 return 0; 00738 }
| int net_help_afs | ( | int | argc, | |
| const char ** | argv | |||
| ) |
参照先 d_printf().
参照元 net_afs()・net_help().
00743 { 00744 d_printf(" net afs key filename\n" 00745 "\tImports a OpenAFS KeyFile into our secrets.tdb\n\n"); 00746 d_printf(" net afs impersonate <user> <cell>\n" 00747 "\tCreates a token for user@cell\n\n"); 00748 return -1; 00749 }
| static int net_afs_key | ( | int | argc, | |
| const char ** | argv | |||
| ) | [static] |
参照先 d_fprintf()・d_printf()・fd・secrets_init()・secrets_store_afs_keyfile().
参照元 net_afs().
00752 { 00753 int fd; 00754 struct afs_keyfile keyfile; 00755 00756 if (argc != 2) { 00757 d_printf("usage: 'net afs key <keyfile> cell'\n"); 00758 return -1; 00759 } 00760 00761 if (!secrets_init()) { 00762 d_fprintf(stderr, "Could not open secrets.tdb\n"); 00763 return -1; 00764 } 00765 00766 if ((fd = open(argv[0], O_RDONLY, 0)) < 0) { 00767 d_fprintf(stderr, "Could not open %s\n", argv[0]); 00768 return -1; 00769 } 00770 00771 if (read(fd, &keyfile, sizeof(keyfile)) != sizeof(keyfile)) { 00772 d_fprintf(stderr, "Could not read keyfile\n"); 00773 return -1; 00774 } 00775 00776 if (!secrets_store_afs_keyfile(argv[1], &keyfile)) { 00777 d_fprintf(stderr, "Could not write keyfile to secrets.tdb\n"); 00778 return -1; 00779 } 00780 00781 return 0; 00782 }
| static int net_afs_impersonate | ( | int | argc, | |
| const char ** | argv | |||
| ) | [static] |
参照先 afs_createtoken_str()・afs_settoken_str()・fprintf()・printf().
参照元 net_afs().
00785 { 00786 char *token; 00787 00788 if (argc != 2) { 00789 fprintf(stderr, "Usage: net afs impersonate <user> <cell>\n"); 00790 exit(1); 00791 } 00792 00793 token = afs_createtoken_str(argv[0], argv[1]); 00794 00795 if (token == NULL) { 00796 fprintf(stderr, "Could not create token\n"); 00797 exit(1); 00798 } 00799 00800 if (!afs_settoken_str(token)) { 00801 fprintf(stderr, "Could not set token into kernel\n"); 00802 exit(1); 00803 } 00804 00805 printf("Success: %s@%s\n", argv[0], argv[1]); 00806 return 0; 00807 }
| static int net_afs | ( | int | argc, | |
| const char ** | argv | |||
| ) | [static] |
参照先 net_afs_impersonate()・net_afs_key()・net_help_afs()・net_run_function().
00810 { 00811 struct functable func[] = { 00812 {"key", net_afs_key}, 00813 {"impersonate", net_afs_impersonate}, 00814 {"help", net_help_afs}, 00815 {NULL, NULL} 00816 }; 00817 return net_run_function(argc, argv, func, net_help_afs); 00818 }
| static BOOL search_maxrid | ( | struct pdb_search * | search, | |
| const char * | type, | |||
| uint32 * | max_rid | |||
| ) | [static] |
参照先 d_fprintf()・pdb_search_destroy()・pdb_search_entries()・samr_displayentry::rid.
参照元 get_maxrid().
00824 { 00825 struct samr_displayentry *entries; 00826 uint32 i, num_entries; 00827 00828 if (search == NULL) { 00829 d_fprintf(stderr, "get_maxrid: Could not search %s\n", type); 00830 return False; 00831 } 00832 00833 num_entries = pdb_search_entries(search, 0, 0xffffffff, &entries); 00834 for (i=0; i<num_entries; i++) 00835 *max_rid = MAX(*max_rid, entries[i].rid); 00836 pdb_search_destroy(search); 00837 return True; 00838 }
| static uint32 get_maxrid | ( | void | ) | [static] |
参照先 get_global_sam_sid()・pdb_search_aliases()・pdb_search_groups()・pdb_search_users()・search_maxrid().
参照元 net_maxrid().
00841 { 00842 uint32 max_rid = 0; 00843 00844 if (!search_maxrid(pdb_search_users(0), "users", &max_rid)) 00845 return 0; 00846 00847 if (!search_maxrid(pdb_search_groups(), "groups", &max_rid)) 00848 return 0; 00849 00850 if (!search_maxrid(pdb_search_aliases(get_global_sam_sid()), 00851 "aliases", &max_rid)) 00852 return 0; 00853 00854 return max_rid; 00855 }
| static int net_maxrid | ( | int | argc, | |
| const char ** | argv | |||
| ) | [static] |
参照先 d_printf()・get_maxrid()・samr_displayentry::rid.
00858 { 00859 uint32 rid; 00860 00861 if (argc != 0) { 00862 DEBUG(0, ("usage: net maxrid\n")); 00863 return 1; 00864 } 00865 00866 if ((rid = get_maxrid()) == 0) { 00867 DEBUG(0, ("can't get current maximum rid\n")); 00868 return 1; 00869 } 00870 00871 d_printf("Currently used maximum rid: %d\n", rid); 00872 00873 return 0; 00874 }
| int main | ( | int | argc, | |
| const char ** | argv | |||
| ) |
参照先 AllowDebugChange・d_fprintf()・dbf・DEBUGLEVEL_CLASS・do_talloc_report・dyn_CONFIGFILE・init_names()・interpret_addr2()・is_zero_ip()・load_case_tables()・load_interfaces()・lp_workgroup()・net_help()・net_run_function()・net_use_krb_machine_account()・opt_acls・opt_attrs・opt_comment・opt_container・opt_dest_ip・opt_destination・opt_domaingroup・opt_exclude・opt_flags・opt_force・opt_have_ip・opt_host・opt_localgroup・opt_long_list_entries・opt_machine_pass・opt_maxusers・opt_newntname・opt_password・opt_port・opt_reboot・opt_requester_name・opt_rid・opt_stdin・opt_target_workgroup・opt_timeout・opt_timestamps・opt_user_name・opt_user_specified・opt_verbose・opt_workgroup・poptBadOption()・poptGetArgs()・poptGetContext()・poptGetNextOpt()・poptGetOptArg()・poptStrerror()・sec_init()・set_global_myname()・smb_xstrdup()・talloc_enable_leak_report()・x_stderr・zero_ip().
00926 { 00927 int opt,i; 00928 char *p; 00929 int rc = 0; 00930 int argc_new = 0; 00931 const char ** argv_new; 00932 poptContext pc; 00933 00934 struct poptOption long_options[] = { 00935 {"help", 'h', POPT_ARG_NONE, 0, 'h'}, 00936 {"workgroup", 'w', POPT_ARG_STRING, &opt_target_workgroup}, 00937 {"user", 'U', POPT_ARG_STRING, &opt_user_name, 'U'}, 00938 {"ipaddress", 'I', POPT_ARG_STRING, 0,'I'}, 00939 {"port", 'p', POPT_ARG_INT, &opt_port}, 00940 {"myname", 'n', POPT_ARG_STRING, &opt_requester_name}, 00941 {"server", 'S', POPT_ARG_STRING, &opt_host}, 00942 {"container", 'c', POPT_ARG_STRING, &opt_container}, 00943 {"comment", 'C', POPT_ARG_STRING, &opt_comment}, 00944 {"maxusers", 'M', POPT_ARG_INT, &opt_maxusers}, 00945 {"flags", 'F', POPT_ARG_INT, &opt_flags}, 00946 {"long", 'l', POPT_ARG_NONE, &opt_long_list_entries}, 00947 {"reboot", 'r', POPT_ARG_NONE, &opt_reboot}, 00948 {"force", 'f', POPT_ARG_NONE, &opt_force}, 00949 {"stdin", 'i', POPT_ARG_NONE, &opt_stdin}, 00950 {"timeout", 't', POPT_ARG_INT, &opt_timeout}, 00951 {"machine-pass",'P', POPT_ARG_NONE, &opt_machine_pass}, 00952 {"myworkgroup", 'W', POPT_ARG_STRING, &opt_workgroup}, 00953 {"verbose", 'v', POPT_ARG_NONE, &opt_verbose}, 00954 /* Options for 'net groupmap set' */ 00955 {"local", 'L', POPT_ARG_NONE, &opt_localgroup}, 00956 {"domain", 'D', POPT_ARG_NONE, &opt_domaingroup}, 00957 {"ntname", 'N', POPT_ARG_STRING, &opt_newntname}, 00958 {"rid", 'R', POPT_ARG_INT, &opt_rid}, 00959 /* Options for 'net rpc share migrate' */ 00960 {"acls", 0, POPT_ARG_NONE, &opt_acls}, 00961 {"attrs", 0, POPT_ARG_NONE, &opt_attrs}, 00962 {"timestamps", 0, POPT_ARG_NONE, &opt_timestamps}, 00963 {"exclude", 'e', POPT_ARG_STRING, &opt_exclude}, 00964 {"destination", 0, POPT_ARG_STRING, &opt_destination}, 00965 {"tallocreport", 0, POPT_ARG_NONE, &do_talloc_report}, 00966 00967 POPT_COMMON_SAMBA 00968 { 0, 0, 0, 0} 00969 }; 00970 00971 zero_ip(&opt_dest_ip); 00972 00973 load_case_tables(); 00974 00975 /* set default debug level to 0 regardless of what smb.conf sets */ 00976 DEBUGLEVEL_CLASS[DBGC_ALL] = 0; 00977 dbf = x_stderr; 00978 00979 pc = poptGetContext(NULL, argc, (const char **) argv, long_options, 00980 POPT_CONTEXT_KEEP_FIRST); 00981 00982 while((opt = poptGetNextOpt(pc)) != -1) { 00983 switch (opt) { 00984 case 'h': 00985 net_help(argc, argv); 00986 exit(0); 00987 break; 00988 case 'I': 00989 opt_dest_ip = *interpret_addr2(poptGetOptArg(pc)); 00990 if (is_zero_ip(opt_dest_ip)) 00991 d_fprintf(stderr, "\nInvalid ip address specified\n"); 00992 else 00993 opt_have_ip = True; 00994 break; 00995 case 'U': 00996 opt_user_specified = True; 00997 opt_user_name = SMB_STRDUP(opt_user_name); 00998 p = strchr(opt_user_name,'%'); 00999 if (p) { 01000 *p = 0; 01001 opt_password = p+1; 01002 } 01003 break; 01004 default: 01005 d_fprintf(stderr, "\nInvalid option %s: %s\n", 01006 poptBadOption(pc, 0), poptStrerror(opt)); 01007 net_help(argc, argv); 01008 exit(1); 01009 } 01010 } 01011 01012 /* 01013 * Don't load debug level from smb.conf. It should be 01014 * set by cmdline arg or remain default (0) 01015 */ 01016 AllowDebugChange = False; 01017 lp_load(dyn_CONFIGFILE,True,False,False,True); 01018 01019 argv_new = (const char **)poptGetArgs(pc); 01020 01021 argc_new = argc; 01022 for (i=0; i<argc; i++) { 01023 if (argv_new[i] == NULL) { 01024 argc_new = i; 01025 break; 01026 } 01027 } 01028 01029 if (do_talloc_report) { 01030 talloc_enable_leak_report(); 01031 } 01032 01033 if (opt_requester_name) { 01034 set_global_myname(opt_requester_name); 01035 } 01036 01037 if (!opt_user_name && getenv("LOGNAME")) { 01038 opt_user_name = getenv("LOGNAME"); 01039 } 01040 01041 if (!opt_user_name) { 01042 opt_user_name = ""; 01043 } 01044 01045 if (!opt_workgroup) { 01046 opt_workgroup = smb_xstrdup(lp_workgroup()); 01047 } 01048 01049 if (!opt_target_workgroup) { 01050 opt_target_workgroup = smb_xstrdup(lp_workgroup()); 01051 } 01052 01053 if (!init_names()) 01054 exit(1); 01055 01056 load_interfaces(); 01057 01058 /* this makes sure that when we do things like call scripts, 01059 that it won't assert becouse we are not root */ 01060 sec_init(); 01061 01062 if (opt_machine_pass) { 01063 /* it is very useful to be able to make ads queries as the 01064 machine account for testing purposes and for domain leave */ 01065 01066 net_use_krb_machine_account(); 01067 } 01068 01069 if (!opt_password) { 01070 opt_password = getenv("PASSWD"); 01071 } 01072 01073 rc = net_run_function(argc_new-1, argv_new+1, net_func, net_help); 01074 01075 DEBUG(2,("return code = %d\n", rc)); 01076 return rc; 01077 }
| const char* opt_requester_name = NULL |
| const char* opt_host = NULL |
参照元 ads_startup_int()・assume_own_realm()・main()・net_ads_check()・net_ads_password()・net_find_server()・net_time()・nettime()・rpc_printer_migrate_all()・rpc_printer_migrate_drivers()・rpc_printer_migrate_forms()・rpc_printer_migrate_printers()・rpc_printer_migrate_security()・rpc_printer_migrate_settings()・rpc_share_migrate_all()・rpc_share_migrate_files()・rpc_share_migrate_security()・rpc_share_migrate_shares().
| const char* opt_password = NULL |
参照元 ads_startup_int()・connect_to_ipc_krb5()・connect_to_service()・create_cs()・local_pw_check()・main()・manage_client_krb5_init()・manage_client_ntlmssp_init()・manage_client_ntlmssp_request()・manage_gss_spnego_client_request()・manage_squid_ntlmssp_request()・net_ads_password()・net_ads_printer_publish()・net_use_krb_machine_account()・net_use_machine_account()・ntlm_auth_start_ntlmssp_client()・ntlm_auth_start_ntlmssp_server()・popt_common_credentials_callback()・rpc_trustdom_establish()・test_lm_ntlm_broken()・test_lmv2_ntlmv2_broken()・test_ntlm_in_both()・test_ntlm_in_lm()・test_plaintext().
| const char* opt_user_name = NULL |
| BOOL opt_user_specified = False |
| const char* opt_workgroup = NULL |
| int opt_long_list_entries = 0 |
参照元 display_share_info_1()・main()・net_ads_group()・net_ads_user()・net_groupmap_list()・net_rap_group()・net_rap_service()・net_rap_share()・net_rap_user()・net_usershare_add()・net_usershare_info()・net_usershare_list()・rpc_group_list_internals()・rpc_list_alias_members()・rpc_list_group_members()・rpc_share_list_internals()・rpc_user_list_internals().
| int opt_reboot = 0 |
| int opt_force = 0 |
| int opt_stdin = 0 |
| int opt_verbose = 0 |
参照元 copy_print_driver_3()・main()・net_copy_file()・net_copy_fileattr()・net_groupmap_list()・rpc_group_delete_internals()・rpc_printer_migrate_drivers_internals()・rpc_printer_migrate_forms_internals()・rpc_printer_migrate_security_internals()・rpc_printer_migrate_settings_internals()・rpc_printer_publish_list_internals()・rpc_share_migrate_security_internals()・verbose_output().
| int opt_maxusers = -1 |
| const char* opt_comment = "" |
| const char* opt_container = NULL |
| int opt_flags = -1 |
| int opt_timeout = 0 |
| const char* opt_target_workgroup = NULL |
参照元 ads_startup_int()・assume_own_realm()・get_user_tokens()・main()・net_ads_lookup()・net_ads_workgroup()・net_find_server()・net_lookup_dc()・net_lookup_ldap()・net_lookup_master()・net_rpc_testjoin()・net_time()・net_use_krb_machine_account()・net_use_machine_account()・rpc_changetrustpw_internals()・rpc_oldjoin_internals()・rpc_trustdom_list()・rpc_trustdom_vampire().
| int opt_machine_pass = 0 |
| BOOL opt_localgroup = False |
| BOOL opt_domaingroup = False |
BOOL do_talloc_report = False [static] |
| const char* opt_newntname = "" |
| int opt_rid = 0 |
| int opt_timestamps = 0 |
| const char* opt_exclude = NULL |
| const char* opt_destination = NULL |
| BOOL opt_have_ip = False |
| struct in_addr opt_dest_ip |
| struct in_addr loopback_ip |
interface.c の 27 行で定義されています。
1.4.7