Changeset 140 for branches/samba-3.0/source/utils
- Timestamp:
- Jul 11, 2008, 1:13:42 AM (17 years ago)
- Location:
- branches/samba-3.0/source/utils
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.0/source/utils/net.c
r134 r140 182 182 opt_password, 0, Undefined, NULL); 183 183 184 if (NT_STATUS_IS_OK(nt_status)) { 184 if (NT_STATUS_IS_OK(nt_status) || 185 NT_STATUS_EQUAL(nt_status, NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT) || 186 NT_STATUS_EQUAL(nt_status, NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT) || 187 NT_STATUS_EQUAL(nt_status, NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT)) { 185 188 return nt_status; 186 } else {187 d_fprintf(stderr, "Could not connect to server %s\n", server_name); 188 189 /* Display a nicer message depending on the result */ 190 191 if (NT_STATUS_V(nt_status) == 192 NT_STATUS_V(NT_STATUS_LOGON_FAILURE))193 d_fprintf(stderr, "The username or password was not correct.\n");194 195 if (NT_STATUS_V(nt_status) == 196 NT_STATUS_V(NT_STATUS_ACCOUNT_LOCKED_OUT))197 d_fprintf(stderr, "The account was locked out.\n");198 199 if (NT_STATUS_V(nt_status) == 200 NT_STATUS_V(NT_STATUS_ACCOUNT_DISABLED))201 d_fprintf(stderr, "The account was disabled.\n");202 203 return nt_status; 204 }189 } 190 191 d_fprintf(stderr, "Could not connect to server %s\n", server_name); 192 193 /* Display a nicer message depending on the result */ 194 195 if (NT_STATUS_V(nt_status) == 196 NT_STATUS_V(NT_STATUS_LOGON_FAILURE)) 197 d_fprintf(stderr, "The username or password was not correct.\n"); 198 199 if (NT_STATUS_V(nt_status) == 200 NT_STATUS_V(NT_STATUS_ACCOUNT_LOCKED_OUT)) 201 d_fprintf(stderr, "The account was locked out.\n"); 202 203 if (NT_STATUS_V(nt_status) == 204 NT_STATUS_V(NT_STATUS_ACCOUNT_DISABLED)) 205 d_fprintf(stderr, "The account was disabled.\n"); 206 207 return nt_status; 205 208 } 206 209 … … 482 485 struct in_addr server_ip; 483 486 struct cli_state *cli = NULL; 484 NTSTATUS nt_status ;487 NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL; 485 488 486 489 if ( !server || !ip ) { … … 494 497 } 495 498 499 if (opt_user_name && opt_password) { 500 nt_status = connect_to_ipc(&cli, &server_ip, server_name); 501 if (NT_STATUS_IS_OK(nt_status)) { 502 goto connected; 503 } 504 } 496 505 if (flags & NET_FLAGS_ANONYMOUS) { 497 506 nt_status = connect_to_ipc_anonymous(&cli, &server_ip, server_name); 498 } else { 499 nt_status = connect_to_ipc(&cli, &server_ip, server_name); 500 } 501 507 if (NT_STATUS_IS_OK(nt_status)) { 508 goto connected; 509 } 510 } 511 512 SAFE_FREE(server_name); 513 d_fprintf(stderr, "Connection failed: %s\n", 514 nt_errstr(nt_status)); 515 return NULL; 516 517 connected: 502 518 /* store the server in the affinity cache if it was a PDC */ 503 519 … … 505 521 saf_store( cli->server_domain, cli->desthost ); 506 522 507 SAFE_FREE(server_name); 508 if (NT_STATUS_IS_OK(nt_status)) { 509 return cli; 510 } else { 511 d_fprintf(stderr, "Connection failed: %s\n", 512 nt_errstr(nt_status)); 513 return NULL; 514 } 523 return cli; 515 524 } 516 525 -
branches/samba-3.0/source/utils/net_domain.c
r124 r140 214 214 uchar pwbuf[532]; 215 215 SAM_USERINFO_CTR ctr; 216 SAM_USER_INFO_24 p24; 216 217 SAM_USER_INFO_25 p25; 217 218 const int infolevel = 25; … … 338 339 infolevel, &cli->user_session_key, &ctr); 339 340 341 if (NT_STATUS_EQUAL(status, NT_STATUS(DCERPC_FAULT_INVALID_TAG))) { 342 343 uchar pwbuf2[516]; 344 345 ZERO_STRUCT(p24); 346 347 encode_pw_buffer(pwbuf2, clear_pw, STR_UNICODE); 348 349 /* retry with level 24 */ 350 init_sam_user_info24(&p24, (char *)pwbuf2, 24); 351 352 ctr.switch_value = 24; 353 ctr.info.id24 = &p24; 354 355 status = rpccli_samr_set_userinfo(pipe_hnd, mem_ctx, 356 &user_pol, 357 24, 358 &cli->user_session_key, 359 &ctr); 360 } 361 340 362 if ( !NT_STATUS_IS_OK(status) ) { 341 363 d_fprintf( stderr, "Failed to set password for machine account (%s)\n", -
branches/samba-3.0/source/utils/net_help.c
r1 r140 62 62 " RPC RAP ADS FILE SHARE SESSION SERVER DOMAIN PRINTQ USER GROUP VALIDATE\n"\ 63 63 " GROUPMEMBER ADMIN SERVICE PASSWORD TIME LOOKUP GETLOCALSID SETLOCALSID\n"\ 64 " SETDOMAINSID CHANGESCRETPW LOOKUP SAM\n");64 " GETDOMAINSID SETDOMAINSID CHANGESCRETPW LOOKUP SAM\n"); 65 65 return -1; 66 66 } … … 229 229 " net join\t\tto join a domain\n"\ 230 230 " net cache\t\tto operate on cache tdb file\n"\ 231 " net getlocalsid [NAME]\tto get the SID for local name\n"\231 " net getlocalsid [NAME]\tto get the SID for local machine name\n"\ 232 232 " net setlocalsid SID\tto set the local domain SID\n"\ 233 " net getdomainsid the machine SID and the domain SID on the local server\n"\ 233 234 " net setdomainsid SID\tto set the domain SID on member servers\n"\ 234 235 " net changesecretpw\tto change the machine password in the local secrets database only\n"\ 235 236 " \tthis requires the -f flag as a safety barrier\n"\ 236 237 " net status\t\tShow server status\n"\ 237 " net usersidlist\tto get a list of all users with their SIDs\n"238 " net usershare\t\tto add, delete and list locally user-modifiable shares\n"238 " net usersidlist\tto get a list of all users with their SIDs\n" 239 " net usershare\t\tto add, delete and list locally user-modifiable shares\n" 239 240 "\n"\ 240 241 " net ads <command>\tto run ADS commands\n"\ -
branches/samba-3.0/source/utils/net_idmap.c
r44 r140 271 271 int net_help_idmap(int argc, const char **argv) 272 272 { 273 d_printf("net idmap dump < outputfile>\n"\273 d_printf("net idmap dump <inputfile>\n"\ 274 274 " Dump current id mapping\n"); 275 275 -
branches/samba-3.0/source/utils/net_rpc.c
r134 r140 5447 5447 argc, argv); 5448 5448 } else { 5449 d_printf("Usage: net rpc trustdom add <domain> \n");5449 d_printf("Usage: net rpc trustdom add <domain> <trust password>\n"); 5450 5450 return -1; 5451 5451 } -
branches/samba-3.0/source/utils/net_rpc_join.c
r134 r140 46 46 uint32_t neg_flags = NETLOGON_NEG_AUTH2_ADS_FLAGS; 47 47 enum security_types sec; 48 unsigned int conn_flags = NET_FLAGS_PDC ;48 unsigned int conn_flags = NET_FLAGS_PDC | NET_FLAGS_ANONYMOUS; 49 49 struct cli_state *cli = NULL; 50 50 struct rpc_pipe_client *pipe_hnd = NULL; … … 59 59 net_use_machine_account(); 60 60 61 } else {62 /* some servers (e.g. WinNT) don't accept machine-authenticated63 smb connections */64 conn_flags |= NET_FLAGS_ANONYMOUS;65 61 } 66 62
Note:
See TracChangeset
for help on using the changeset viewer.