Changeset 988 for vendor/current/source3/rpcclient
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- Location:
- vendor/current/source3/rpcclient
- Files:
-
- 3 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/rpcclient/cmd_dfs.c
r740 r988 59 59 WERROR werr; 60 60 const char *path, *servername, *sharename, *comment; 61 uint32 flags = 0;61 uint32_t flags = 0; 62 62 struct dcerpc_binding_handle *b = cli->binding_handle; 63 63 … … 150 150 151 151 /* Display a DFS_INFO_CTR structure */ 152 static void display_dfs_info(uint32 level, union dfs_Info *ctr)152 static void display_dfs_info(uint32_t level, union dfs_Info *ctr) 153 153 { 154 154 switch (level) { … … 203 203 NTSTATUS result; 204 204 WERROR werr; 205 uint32 total = 0;205 uint32_t total = 0; 206 206 207 207 if (argc > 2) { … … 254 254 NTSTATUS result; 255 255 WERROR werr; 256 uint32 total = 0;256 uint32_t total = 0; 257 257 258 258 if (argc < 2 || argc > 3) { … … 297 297 WERROR werr; 298 298 const char *path, *servername, *sharename; 299 uint32 info_level = 1;299 uint32_t info_level = 1; 300 300 union dfs_Info ctr; 301 301 struct dcerpc_binding_handle *b = cli->binding_handle; … … 332 332 { "DFS" }, 333 333 334 { "dfsversion", RPC_RTYPE_WERROR, NULL, cmd_dfs_version, &ndr_table_netdfs .syntax_id, NULL, "Query DFS support", "" },335 { "dfsadd", RPC_RTYPE_WERROR, NULL, cmd_dfs_add, &ndr_table_netdfs .syntax_id, NULL, "Add a DFS share", "" },336 { "dfsremove", RPC_RTYPE_WERROR, NULL, cmd_dfs_remove, &ndr_table_netdfs .syntax_id, NULL, "Remove a DFS share", "" },337 { "dfsgetinfo", RPC_RTYPE_WERROR, NULL, cmd_dfs_getinfo, &ndr_table_netdfs .syntax_id, NULL, "Query DFS share info", "" },338 { "dfsenum", RPC_RTYPE_WERROR, NULL, cmd_dfs_enum, &ndr_table_netdfs .syntax_id, NULL, "Enumerate dfs shares", "" },339 { "dfsenumex", RPC_RTYPE_WERROR, NULL, cmd_dfs_enumex, &ndr_table_netdfs .syntax_id, NULL, "Enumerate dfs shares", "" },334 { "dfsversion", RPC_RTYPE_WERROR, NULL, cmd_dfs_version, &ndr_table_netdfs, NULL, "Query DFS support", "" }, 335 { "dfsadd", RPC_RTYPE_WERROR, NULL, cmd_dfs_add, &ndr_table_netdfs, NULL, "Add a DFS share", "" }, 336 { "dfsremove", RPC_RTYPE_WERROR, NULL, cmd_dfs_remove, &ndr_table_netdfs, NULL, "Remove a DFS share", "" }, 337 { "dfsgetinfo", RPC_RTYPE_WERROR, NULL, cmd_dfs_getinfo, &ndr_table_netdfs, NULL, "Query DFS share info", "" }, 338 { "dfsenum", RPC_RTYPE_WERROR, NULL, cmd_dfs_enum, &ndr_table_netdfs, NULL, "Enumerate dfs shares", "" }, 339 { "dfsenumex", RPC_RTYPE_WERROR, NULL, cmd_dfs_enumex, &ndr_table_netdfs, NULL, "Enumerate dfs shares", "" }, 340 340 341 341 { NULL } -
vendor/current/source3/rpcclient/cmd_drsuapi.c
r740 r988 41 41 struct dcerpc_binding_handle *b = cli->binding_handle; 42 42 43 names = TALLOC_ZERO_ARRAY(mem_ctx, struct drsuapi_DsNameString, argc);43 names = talloc_zero_array(mem_ctx, struct drsuapi_DsNameString, argc); 44 44 W_ERROR_HAVE_NO_MEMORY(names); 45 45 … … 421 421 } else if (bind_info.length == 28) { 422 422 supported_extensions = bind_info.info.info28.supported_extensions; 423 } else if (bind_info.length == 32) { 424 supported_extensions = bind_info.info.info32.supported_extensions; 423 425 } else if (bind_info.length == 48) { 424 426 supported_extensions = bind_info.info.info48.supported_extensions; 427 } else if (bind_info.length == 52) { 428 supported_extensions = bind_info.info.info52.supported_extensions; 425 429 } 426 430 … … 584 588 585 589 { "DRSUAPI" }, 586 { "dscracknames", RPC_RTYPE_WERROR, NULL, cmd_drsuapi_cracknames, &ndr_table_drsuapi .syntax_id, NULL, "Crack Name", "" },587 { "dsgetdcinfo", RPC_RTYPE_WERROR, NULL, cmd_drsuapi_getdcinfo, &ndr_table_drsuapi .syntax_id, NULL, "Get Domain Controller Info", "" },588 { "dsgetncchanges", RPC_RTYPE_WERROR, NULL, cmd_drsuapi_getncchanges, &ndr_table_drsuapi .syntax_id, NULL, "Get NC Changes", "" },590 { "dscracknames", RPC_RTYPE_WERROR, NULL, cmd_drsuapi_cracknames, &ndr_table_drsuapi, NULL, "Crack Name", "" }, 591 { "dsgetdcinfo", RPC_RTYPE_WERROR, NULL, cmd_drsuapi_getdcinfo, &ndr_table_drsuapi, NULL, "Get Domain Controller Info", "" }, 592 { "dsgetncchanges", RPC_RTYPE_WERROR, NULL, cmd_drsuapi_getncchanges, &ndr_table_drsuapi, NULL, "Get NC Changes", "" }, 589 593 { NULL } 590 594 }; -
vendor/current/source3/rpcclient/cmd_dssetup.c
r740 r988 66 66 { "LSARPC-DS" }, 67 67 68 { "dsroledominfo", RPC_RTYPE_WERROR, NULL, cmd_ds_dsrole_getprimarydominfo, &ndr_table_dssetup .syntax_id, NULL, "Get Primary Domain Information", "" },68 { "dsroledominfo", RPC_RTYPE_WERROR, NULL, cmd_ds_dsrole_getprimarydominfo, &ndr_table_dssetup, NULL, "Get Primary Domain Information", "" }, 69 69 70 70 { NULL } -
vendor/current/source3/rpcclient/cmd_echo.c
r740 r988 27 27 { 28 28 struct dcerpc_binding_handle *b = cli->binding_handle; 29 uint32 request = 1, response;29 uint32_t request = 1, response; 30 30 NTSTATUS status; 31 31 … … 54 54 { 55 55 struct dcerpc_binding_handle *b = cli->binding_handle; 56 uint32 size, i;56 uint32_t size, i; 57 57 NTSTATUS status; 58 58 uint8_t *in_data = NULL, *out_data = NULL; … … 106 106 { 107 107 struct dcerpc_binding_handle *b = cli->binding_handle; 108 uint32 size, i;108 uint32_t size, i; 109 109 NTSTATUS status; 110 110 uint8_t *out_data = NULL; … … 147 147 { 148 148 struct dcerpc_binding_handle *b = cli->binding_handle; 149 uint32 size, i;149 uint32_t size, i; 150 150 NTSTATUS status; 151 151 uint8_t *in_data = NULL; … … 185 185 { "ECHO" }, 186 186 187 { "echoaddone", RPC_RTYPE_NTSTATUS, cmd_echo_add_one, NULL, &ndr_table_rpcecho .syntax_id, NULL, "Add one to a number", "" },188 { "echodata", RPC_RTYPE_NTSTATUS, cmd_echo_data, NULL, &ndr_table_rpcecho .syntax_id, NULL, "Echo data", "" },189 { "sinkdata", RPC_RTYPE_NTSTATUS, cmd_echo_sink_data, NULL, &ndr_table_rpcecho .syntax_id, NULL, "Sink data", "" },190 { "sourcedata", RPC_RTYPE_NTSTATUS, cmd_echo_source_data, NULL, &ndr_table_rpcecho .syntax_id, NULL, "Source data", "" },187 { "echoaddone", RPC_RTYPE_NTSTATUS, cmd_echo_add_one, NULL, &ndr_table_rpcecho, NULL, "Add one to a number", "" }, 188 { "echodata", RPC_RTYPE_NTSTATUS, cmd_echo_data, NULL, &ndr_table_rpcecho, NULL, "Echo data", "" }, 189 { "sinkdata", RPC_RTYPE_NTSTATUS, cmd_echo_sink_data, NULL, &ndr_table_rpcecho, NULL, "Sink data", "" }, 190 { "sourcedata", RPC_RTYPE_NTSTATUS, cmd_echo_source_data, NULL, &ndr_table_rpcecho, NULL, "Source data", "" }, 191 191 { NULL } 192 192 }; -
vendor/current/source3/rpcclient/cmd_epmapper.c
r740 r988 29 29 { 30 30 struct dcerpc_binding_handle *b = p->binding_handle; 31 struct dcerpc_binding map_binding;31 struct dcerpc_binding *map_binding; 32 32 struct epm_twr_t map_tower; 33 33 struct epm_twr_p_t towers[500]; … … 42 42 abstract_syntax = ndr_table_lsarpc.syntax_id; 43 43 44 map_binding.transport = NCACN_NP; 45 map_binding.object = abstract_syntax; 46 map_binding.host = "127.0.0.1"; /* needed? */ 47 map_binding.endpoint = "0"; /* correct? needed? */ 44 /* 127.0.0.1[0] => correct? needed? */ 45 status = dcerpc_parse_binding(tmp_ctx, "ncacn_np:127.0.0.1[0]", 46 &map_binding); 47 if (!NT_STATUS_IS_OK(status)) { 48 d_fprintf(stderr, "dcerpc_parse_binding returned %s\n", 49 nt_errstr(status)); 50 goto done; 51 } 48 52 49 status = dcerpc_binding_build_tower(tmp_ctx, &map_binding, 53 status = dcerpc_binding_set_abstract_syntax(map_binding, 54 &abstract_syntax); 55 if (!NT_STATUS_IS_OK(status)) { 56 d_fprintf(stderr, "dcerpc_binding_set_abstract_syntax returned %s\n", 57 nt_errstr(status)); 58 goto done; 59 } 60 61 status = dcerpc_binding_build_tower(tmp_ctx, map_binding, 50 62 &map_tower.tower); 51 63 if (!NT_STATUS_IS_OK(status)) { 52 64 d_fprintf(stderr, "dcerpc_binding_build_tower returned %s\n", 53 65 nt_errstr(status)); 54 return status;66 goto done; 55 67 } 56 68 … … 65 77 d_fprintf(stderr, "dcerpc_epm_Map returned %s\n", 66 78 nt_errstr(status)); 67 return status;79 goto done; 68 80 } 69 81 … … 71 83 d_fprintf(stderr, "epm_Map returned %u (0x%08X)\n", 72 84 result, result); 73 return NT_STATUS_UNSUCCESSFUL; 85 status = NT_STATUS_UNSUCCESSFUL; 86 goto done; 74 87 } 75 88 … … 92 105 d_printf("tower[%u] %s\n", i, dcerpc_binding_string(tmp_ctx, binding)); 93 106 } 94 95 return NT_STATUS_OK; 107 done: 108 TALLOC_FREE(tmp_ctx); 109 return status; 96 110 } 97 111 … … 175 189 176 190 { "epmmap", RPC_RTYPE_NTSTATUS, cmd_epmapper_map, NULL, 177 &ndr_table_epmapper .syntax_id, NULL, "Map a binding", "" },191 &ndr_table_epmapper, NULL, "Map a binding", "" }, 178 192 { "epmlookup", RPC_RTYPE_NTSTATUS, cmd_epmapper_lookup, NULL, 179 &ndr_table_epmapper .syntax_id, NULL, "Lookup bindings", "" },193 &ndr_table_epmapper, NULL, "Lookup bindings", "" }, 180 194 { NULL } 181 195 }; -
vendor/current/source3/rpcclient/cmd_eventlog.c
r740 r988 70 70 uint32_t offset = 0; 71 71 uint32_t number_of_bytes = 0; 72 uint8_t *data = NULL;72 uint8_t *data; 73 73 uint32_t sent_size = 0; 74 74 uint32_t real_size = 0; … … 85 85 if (argc >= 4) { 86 86 number_of_bytes = atoi(argv[3]); 87 data = talloc_array(mem_ctx, uint8_t, number_of_bytes); 88 if (!data) { 89 goto done; 90 } 91 } 92 93 status = get_eventlog_handle(cli, mem_ctx, argv[1], &handle); 94 if (!NT_STATUS_IS_OK(status)) { 95 return status; 87 } 88 89 status = get_eventlog_handle(cli, mem_ctx, argv[1], &handle); 90 if (!NT_STATUS_IS_OK(status)) { 91 return status; 92 } 93 94 data = talloc_array(mem_ctx, uint8_t, number_of_bytes); 95 if (data == NULL) { 96 goto done; 96 97 } 97 98 … … 119 120 real_size > 0 ) { 120 121 number_of_bytes = real_size; 121 data = talloc_ array(mem_ctx, uint8_t, real_size);122 if ( !data) {122 data = talloc_realloc(mem_ctx, data, uint8_t, real_size); 123 if (data == NULL) { 123 124 goto done; 124 125 } … … 510 511 } 511 512 513 buffer = talloc_array(mem_ctx, uint8_t, bytes_needed); 514 if (buffer == NULL) { 515 status = NT_STATUS_NO_MEMORY; 516 goto done; 517 } 518 512 519 status = dcerpc_eventlog_GetLogInformation(b, mem_ctx, 513 520 &handle, … … 526 533 527 534 buf_size = bytes_needed; 528 buffer = talloc_ array(mem_ctx, uint8_t, bytes_needed);529 if ( !buffer) {535 buffer = talloc_realloc(mem_ctx, buffer, uint8_t, bytes_needed); 536 if (buffer == NULL) { 530 537 status = NT_STATUS_NO_MEMORY; 531 538 goto done; … … 556 563 struct cmd_set eventlog_commands[] = { 557 564 { "EVENTLOG" }, 558 { "eventlog_readlog", RPC_RTYPE_NTSTATUS, cmd_eventlog_readlog, NULL, &ndr_table_eventlog .syntax_id, NULL, "Read Eventlog", "" },559 { "eventlog_numrecord", RPC_RTYPE_NTSTATUS, cmd_eventlog_numrecords, NULL, &ndr_table_eventlog .syntax_id, NULL, "Get number of records", "" },560 { "eventlog_oldestrecord", RPC_RTYPE_NTSTATUS, cmd_eventlog_oldestrecord, NULL, &ndr_table_eventlog .syntax_id, NULL, "Get oldest record", "" },561 { "eventlog_reportevent", RPC_RTYPE_NTSTATUS, cmd_eventlog_reportevent, NULL, &ndr_table_eventlog .syntax_id, NULL, "Report event", "" },562 { "eventlog_reporteventsource", RPC_RTYPE_NTSTATUS, cmd_eventlog_reporteventsource, NULL, &ndr_table_eventlog .syntax_id, NULL, "Report event and source", "" },563 { "eventlog_registerevsource", RPC_RTYPE_NTSTATUS, cmd_eventlog_registerevsource, NULL, &ndr_table_eventlog .syntax_id, NULL, "Register event source", "" },564 { "eventlog_backuplog", RPC_RTYPE_NTSTATUS, cmd_eventlog_backuplog, NULL, &ndr_table_eventlog .syntax_id, NULL, "Backup Eventlog File", "" },565 { "eventlog_loginfo", RPC_RTYPE_NTSTATUS, cmd_eventlog_loginfo, NULL, &ndr_table_eventlog .syntax_id, NULL, "Get Eventlog Information", "" },565 { "eventlog_readlog", RPC_RTYPE_NTSTATUS, cmd_eventlog_readlog, NULL, &ndr_table_eventlog, NULL, "Read Eventlog", "" }, 566 { "eventlog_numrecord", RPC_RTYPE_NTSTATUS, cmd_eventlog_numrecords, NULL, &ndr_table_eventlog, NULL, "Get number of records", "" }, 567 { "eventlog_oldestrecord", RPC_RTYPE_NTSTATUS, cmd_eventlog_oldestrecord, NULL, &ndr_table_eventlog, NULL, "Get oldest record", "" }, 568 { "eventlog_reportevent", RPC_RTYPE_NTSTATUS, cmd_eventlog_reportevent, NULL, &ndr_table_eventlog, NULL, "Report event", "" }, 569 { "eventlog_reporteventsource", RPC_RTYPE_NTSTATUS, cmd_eventlog_reporteventsource, NULL, &ndr_table_eventlog, NULL, "Report event and source", "" }, 570 { "eventlog_registerevsource", RPC_RTYPE_NTSTATUS, cmd_eventlog_registerevsource, NULL, &ndr_table_eventlog, NULL, "Register event source", "" }, 571 { "eventlog_backuplog", RPC_RTYPE_NTSTATUS, cmd_eventlog_backuplog, NULL, &ndr_table_eventlog, NULL, "Backup Eventlog File", "" }, 572 { "eventlog_loginfo", RPC_RTYPE_NTSTATUS, cmd_eventlog_loginfo, NULL, &ndr_table_eventlog, NULL, "Get Eventlog Information", "" }, 566 573 { NULL } 567 574 }; -
vendor/current/source3/rpcclient/cmd_lsarpc.c
r860 r988 162 162 struct dcerpc_binding_handle *b = cli->binding_handle; 163 163 164 uint32 info_class = 3;164 uint32_t info_class = 3; 165 165 166 166 if (argc > 2) { … … 405 405 /* Convert arguments to sids */ 406 406 407 sids = TALLOC_ARRAY(mem_ctx, struct dom_sid, argc - 1);407 sids = talloc_array(mem_ctx, struct dom_sid, argc - 1); 408 408 409 409 if (!sids) { … … 435 435 436 436 sid_to_fstring(sid_str, &sids[i]); 437 printf("%s %s\\%s (%d)\n", sid_str, 438 domains[i] ? domains[i] : "*unknown*", 439 names[i] ? names[i] : "*unknown*", types[i]); 437 if (types[i] == SID_NAME_DOMAIN) { 438 printf("%s %s (%d)\n", sid_str, 439 domains[i] ? domains[i] : "*unknown*", 440 types[i]); 441 } else { 442 printf("%s %s\\%s (%d)\n", sid_str, 443 domains[i] ? domains[i] : "*unknown*", 444 names[i] ? names[i] : "*unknown*", 445 types[i]); 446 } 440 447 } 441 448 … … 540 547 541 548 /* defaults, but may be changed using params */ 542 uint32 enum_ctx = 0;549 uint32_t enum_ctx = 0; 543 550 int i; 544 551 uint32_t max_size = (uint32_t)-1; … … 611 618 struct dcerpc_binding_handle *b = cli->binding_handle; 612 619 613 uint32 enum_context=0;614 uint32 pref_max_length=0x1000;620 uint32_t enum_context=0; 621 uint32_t pref_max_length=0x1000; 615 622 int i; 616 623 … … 673 680 struct dcerpc_binding_handle *b = cli->binding_handle; 674 681 675 uint16 lang_id=0;676 uint16 lang_id_sys=0;677 uint16 lang_id_desc;682 uint16_t lang_id=0; 683 uint16_t lang_id_sys=0; 684 uint16_t lang_id_desc; 678 685 struct lsa_String lsa_name; 679 686 struct lsa_StringLarge *description = NULL; … … 726 733 struct dcerpc_binding_handle *b = cli->binding_handle; 727 734 728 uint32 enum_context=0;729 uint32 pref_max_length=0x1000;735 uint32_t enum_context=0; 736 uint32_t pref_max_length=0x1000; 730 737 struct lsa_SidArray sid_array; 731 738 int i; … … 786 793 struct policy_handle user_pol; 787 794 NTSTATUS status, result; 788 uint32 des_access = 0x000f000f;795 uint32_t des_access = 0x000f000f; 789 796 struct dcerpc_binding_handle *b = cli->binding_handle; 790 797 … … 838 845 struct policy_handle user_pol; 839 846 NTSTATUS status, result; 840 uint32 access_desired = 0x000f000f;847 uint32_t access_desired = 0x000f000f; 841 848 struct dom_sid sid; 842 849 struct lsa_PrivilegeSet *privs = NULL; … … 986 993 987 994 rights.count = argc-2; 988 rights.names = TALLOC_ARRAY(mem_ctx, struct lsa_StringLarge,995 rights.names = talloc_array(mem_ctx, struct lsa_StringLarge, 989 996 rights.count); 990 997 if (!rights.names) { … … 1044 1051 1045 1052 rights.count = argc-2; 1046 rights.names = TALLOC_ARRAY(mem_ctx, struct lsa_StringLarge,1053 rights.names = talloc_array(mem_ctx, struct lsa_StringLarge, 1047 1054 rights.count); 1048 1055 if (!rights.names) { … … 1130 1137 NTSTATUS status, result; 1131 1138 struct sec_desc_buf *sdb; 1132 uint32 sec_info = SECINFO_DACL;1139 uint32_t sec_info = SECINFO_DACL; 1133 1140 struct dcerpc_binding_handle *b = cli->binding_handle; 1134 1141 … … 1170 1177 1171 1178 static void display_trust_dom_info_4(struct lsa_TrustDomainInfoPassword *p, 1172 uint8_t session_key[16])1179 DATA_BLOB session_key) 1173 1180 { 1174 1181 char *pwd, *pwd_old; … … 1176 1183 DATA_BLOB data = data_blob_const(p->password->data, p->password->length); 1177 1184 DATA_BLOB data_old = data_blob_const(p->old_password->data, p->old_password->length); 1178 DATA_BLOB session_key_blob = data_blob_const(session_key, 16); 1179 1180 pwd = sess_decrypt_string(talloc_tos(), &data, &session_key_blob); 1181 pwd_old = sess_decrypt_string(talloc_tos(), &data_old, &session_key_blob); 1185 1186 pwd = sess_decrypt_string(talloc_tos(), &data, &session_key); 1187 pwd_old = sess_decrypt_string(talloc_tos(), &data_old, &session_key); 1182 1188 1183 1189 d_printf("Password:\t%s\n", pwd); … … 1191 1197 union lsa_TrustedDomainInfo *info, 1192 1198 enum lsa_TrustDomInfoEnum info_class, 1193 uint8_t nt_hash[16])1199 DATA_BLOB session_key) 1194 1200 { 1195 1201 switch (info_class) { 1196 1202 case LSA_TRUSTED_DOMAIN_INFO_PASSWORD: 1197 display_trust_dom_info_4(&info->password, nt_hash);1203 display_trust_dom_info_4(&info->password, session_key); 1198 1204 break; 1199 1205 default: { … … 1217 1223 NTSTATUS status, result; 1218 1224 struct dom_sid dom_sid; 1219 uint32 access_mask = SEC_FLAG_MAXIMUM_ALLOWED;1225 uint32_t access_mask = SEC_FLAG_MAXIMUM_ALLOWED; 1220 1226 union lsa_TrustedDomainInfo *info = NULL; 1221 1227 enum lsa_TrustDomInfoEnum info_class = 1; 1222 uint8_t nt_hash[16];1228 DATA_BLOB session_key; 1223 1229 struct dcerpc_binding_handle *b = cli->binding_handle; 1224 1230 … … 1252 1258 } 1253 1259 1254 if (!rpccli_get_pwd_hash(cli, nt_hash)) { 1255 d_fprintf(stderr, "Could not get pwd hash\n"); 1256 goto done; 1257 } 1258 1259 display_trust_dom_info(mem_ctx, info, info_class, nt_hash); 1260 status = cli_get_session_key(mem_ctx, cli, &session_key); 1261 if (!NT_STATUS_IS_OK(status)) { 1262 DEBUG(0, ("Could not retrieve session key: %s\n", nt_errstr(status))); 1263 goto done; 1264 } 1265 1266 display_trust_dom_info(mem_ctx, info, info_class, session_key); 1260 1267 1261 1268 done: … … 1271 1278 struct policy_handle pol; 1272 1279 NTSTATUS status, result; 1273 uint32 access_mask = SEC_FLAG_MAXIMUM_ALLOWED;1280 uint32_t access_mask = SEC_FLAG_MAXIMUM_ALLOWED; 1274 1281 union lsa_TrustedDomainInfo *info = NULL; 1275 1282 enum lsa_TrustDomInfoEnum info_class = 1; 1276 1283 struct lsa_String trusted_domain; 1277 uint8_t nt_hash[16];1278 struct dcerpc_binding_handle *b = cli->binding_handle;1284 struct dcerpc_binding_handle *b = cli->binding_handle; 1285 DATA_BLOB session_key; 1279 1286 1280 1287 if (argc > 3 || argc < 2) { … … 1306 1313 } 1307 1314 1308 if (!rpccli_get_pwd_hash(cli, nt_hash)) { 1309 d_fprintf(stderr, "Could not get pwd hash\n"); 1310 goto done; 1311 } 1312 1313 display_trust_dom_info(mem_ctx, info, info_class, nt_hash); 1315 status = cli_get_session_key(mem_ctx, cli, &session_key); 1316 if (!NT_STATUS_IS_OK(status)) { 1317 DEBUG(0, ("Could not retrieve session key: %s\n", nt_errstr(status))); 1318 goto done; 1319 } 1320 1321 display_trust_dom_info(mem_ctx, info, info_class, session_key); 1314 1322 1315 1323 done: … … 1319 1327 } 1320 1328 1321 static NTSTATUS cmd_lsa_ query_trustdominfo(struct rpc_pipe_client *cli,1322 1323 const char **argv)1329 static NTSTATUS cmd_lsa_set_trustdominfo(struct rpc_pipe_client *cli, 1330 TALLOC_CTX *mem_ctx, int argc, 1331 const char **argv) 1324 1332 { 1325 1333 struct policy_handle pol, trustdom_pol; 1326 1334 NTSTATUS status, result; 1327 uint32 access_mask = SEC_FLAG_MAXIMUM_ALLOWED;1328 union lsa_TrustedDomainInfo *info = NULL;1335 uint32_t access_mask = SEC_FLAG_MAXIMUM_ALLOWED; 1336 union lsa_TrustedDomainInfo info; 1329 1337 struct dom_sid dom_sid; 1330 1338 enum lsa_TrustDomInfoEnum info_class = 1; 1331 uint8_t nt_hash[16]; 1332 struct dcerpc_binding_handle *b = cli->binding_handle; 1333 1334 if (argc > 3 || argc < 2) { 1335 printf("Usage: %s [sid] [info_class]\n", argv[0]); 1336 return NT_STATUS_OK; 1337 } 1338 1339 if (!string_to_sid(&dom_sid, argv[1])) 1339 struct dcerpc_binding_handle *b = cli->binding_handle; 1340 1341 if (argc > 4 || argc < 3) { 1342 printf("Usage: %s [sid] [info_class] [value]\n", argv[0]); 1343 return NT_STATUS_OK; 1344 } 1345 1346 if (!string_to_sid(&dom_sid, argv[1])) { 1340 1347 return NT_STATUS_NO_MEMORY; 1341 1342 1343 if (argc == 3) 1344 info_class = atoi(argv[2]); 1348 } 1349 1350 1351 info_class = atoi(argv[2]); 1352 1353 switch (info_class) { 1354 case 13: /* LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRYPTION_TYPES */ 1355 info.enc_types.enc_types = atoi(argv[3]); 1356 break; 1357 default: 1358 return NT_STATUS_INVALID_PARAMETER; 1359 } 1345 1360 1346 1361 status = rpccli_lsa_open_policy2(cli, mem_ctx, True, access_mask, &pol); 1347 1348 if (!NT_STATUS_IS_OK(status))1349 goto done;1362 if (!NT_STATUS_IS_OK(status)) { 1363 goto done; 1364 } 1350 1365 1351 1366 status = dcerpc_lsa_OpenTrustedDomain(b, mem_ctx, … … 1355 1370 &trustdom_pol, 1356 1371 &result); 1372 if (!NT_STATUS_IS_OK(status)) { 1373 goto done; 1374 } 1375 if (!NT_STATUS_IS_OK(result)) { 1376 status = result; 1377 goto done; 1378 } 1379 1380 status = dcerpc_lsa_SetInformationTrustedDomain(b, mem_ctx, 1381 &trustdom_pol, 1382 info_class, 1383 &info, 1384 &result); 1385 if (!NT_STATUS_IS_OK(status)) { 1386 goto done; 1387 } 1388 if (!NT_STATUS_IS_OK(result)) { 1389 status = result; 1390 goto done; 1391 } 1392 done: 1393 dcerpc_lsa_Close(b, mem_ctx, &trustdom_pol, &result); 1394 dcerpc_lsa_Close(b, mem_ctx, &pol, &result); 1395 1396 return status; 1397 } 1398 1399 static NTSTATUS cmd_lsa_query_trustdominfo(struct rpc_pipe_client *cli, 1400 TALLOC_CTX *mem_ctx, int argc, 1401 const char **argv) 1402 { 1403 struct policy_handle pol, trustdom_pol; 1404 NTSTATUS status, result; 1405 uint32_t access_mask = SEC_FLAG_MAXIMUM_ALLOWED; 1406 union lsa_TrustedDomainInfo *info = NULL; 1407 struct dom_sid dom_sid; 1408 enum lsa_TrustDomInfoEnum info_class = 1; 1409 DATA_BLOB session_key; 1410 struct dcerpc_binding_handle *b = cli->binding_handle; 1411 1412 if (argc > 3 || argc < 2) { 1413 printf("Usage: %s [sid] [info_class]\n", argv[0]); 1414 return NT_STATUS_OK; 1415 } 1416 1417 if (!string_to_sid(&dom_sid, argv[1])) 1418 return NT_STATUS_NO_MEMORY; 1419 1420 1421 if (argc == 3) 1422 info_class = atoi(argv[2]); 1423 1424 status = rpccli_lsa_open_policy2(cli, mem_ctx, True, access_mask, &pol); 1425 1426 if (!NT_STATUS_IS_OK(status)) 1427 goto done; 1428 1429 status = dcerpc_lsa_OpenTrustedDomain(b, mem_ctx, 1430 &pol, 1431 &dom_sid, 1432 access_mask, 1433 &trustdom_pol, 1434 &result); 1357 1435 if (!NT_STATUS_IS_OK(status)) 1358 1436 goto done; … … 1374 1452 } 1375 1453 1376 if (!rpccli_get_pwd_hash(cli, nt_hash)) { 1377 d_fprintf(stderr, "Could not get pwd hash\n"); 1378 goto done; 1379 } 1380 1381 display_trust_dom_info(mem_ctx, info, info_class, nt_hash); 1454 status = cli_get_session_key(mem_ctx, cli, &session_key); 1455 if (!NT_STATUS_IS_OK(status)) { 1456 DEBUG(0, ("Could not retrieve session key: %s\n", nt_errstr(status))); 1457 goto done; 1458 } 1459 1460 display_trust_dom_info(mem_ctx, info, info_class, session_key); 1382 1461 1383 1462 done: … … 1391 1470 const char **argv) 1392 1471 { 1393 struct policy_handle pol;1394 1472 NTSTATUS status, result; 1395 1473 const char *servername = cli->desthost; … … 1401 1479 printf("Usage: %s servername\n", argv[0]); 1402 1480 return NT_STATUS_OK; 1403 }1404 1405 status = rpccli_lsa_open_policy(cli, mem_ctx, true,1406 SEC_FLAG_MAXIMUM_ALLOWED,1407 &pol);1408 1409 if (!NT_STATUS_IS_OK(status)) {1410 goto done;1411 1481 } 1412 1482 … … 1430 1500 ""); 1431 1501 1432 dcerpc_lsa_Close(b, mem_ctx, &pol, &result);1433 1502 done: 1434 1503 return status; … … 1502 1571 1503 1572 privs.count++; 1504 set = TALLOC_REALLOC_ARRAY(mem_ctx, set,1573 set = talloc_realloc(mem_ctx, set, 1505 1574 struct lsa_LUIDAttribute, 1506 1575 privs.count); … … 1600 1669 1601 1670 privs.count++; 1602 set = TALLOC_REALLOC_ARRAY(mem_ctx, set,1671 set = talloc_realloc(mem_ctx, set, 1603 1672 struct lsa_LUIDAttribute, 1604 1673 privs.count); … … 2208 2277 { "LSARPC" }, 2209 2278 2210 { "lsaquery", RPC_RTYPE_NTSTATUS, cmd_lsa_query_info_policy, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Query info policy", "" }, 2211 { "lookupsids", RPC_RTYPE_NTSTATUS, cmd_lsa_lookup_sids, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Convert SIDs to names", "" }, 2212 { "lookupsids3", RPC_RTYPE_NTSTATUS, cmd_lsa_lookup_sids3, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Convert SIDs to names", "" }, 2213 { "lookupnames", RPC_RTYPE_NTSTATUS, cmd_lsa_lookup_names, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Convert names to SIDs", "" }, 2214 { "lookupnames4", RPC_RTYPE_NTSTATUS, cmd_lsa_lookup_names4, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Convert names to SIDs", "" }, 2215 { "lookupnames_level", RPC_RTYPE_NTSTATUS, cmd_lsa_lookup_names_level, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Convert names to SIDs", "" }, 2216 { "enumtrust", RPC_RTYPE_NTSTATUS, cmd_lsa_enum_trust_dom, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Enumerate trusted domains", "Usage: [preferred max number] [enum context (0)]" }, 2217 { "enumprivs", RPC_RTYPE_NTSTATUS, cmd_lsa_enum_privilege, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Enumerate privileges", "" }, 2218 { "getdispname", RPC_RTYPE_NTSTATUS, cmd_lsa_get_dispname, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Get the privilege name", "" }, 2219 { "lsaenumsid", RPC_RTYPE_NTSTATUS, cmd_lsa_enum_sids, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Enumerate the LSA SIDS", "" }, 2220 { "lsacreateaccount", RPC_RTYPE_NTSTATUS, cmd_lsa_create_account, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Create a new lsa account", "" }, 2221 { "lsaenumprivsaccount", RPC_RTYPE_NTSTATUS, cmd_lsa_enum_privsaccounts, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Enumerate the privileges of an SID", "" }, 2222 { "lsaenumacctrights", RPC_RTYPE_NTSTATUS, cmd_lsa_enum_acct_rights, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Enumerate the rights of an SID", "" }, 2223 { "lsaaddpriv", RPC_RTYPE_NTSTATUS, cmd_lsa_add_priv, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Assign a privilege to a SID", "" }, 2224 { "lsadelpriv", RPC_RTYPE_NTSTATUS, cmd_lsa_del_priv, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Revoke a privilege from a SID", "" }, 2225 { "lsaaddacctrights", RPC_RTYPE_NTSTATUS, cmd_lsa_add_acct_rights, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Add rights to an account", "" }, 2226 { "lsaremoveacctrights", RPC_RTYPE_NTSTATUS, cmd_lsa_remove_acct_rights, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Remove rights from an account", "" }, 2227 { "lsalookupprivvalue", RPC_RTYPE_NTSTATUS, cmd_lsa_lookup_priv_value, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Get a privilege value given its name", "" }, 2228 { "lsaquerysecobj", RPC_RTYPE_NTSTATUS, cmd_lsa_query_secobj, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Query LSA security object", "" }, 2229 { "lsaquerytrustdominfo",RPC_RTYPE_NTSTATUS, cmd_lsa_query_trustdominfo, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Query LSA trusted domains info (given a SID)", "" }, 2230 { "lsaquerytrustdominfobyname",RPC_RTYPE_NTSTATUS, cmd_lsa_query_trustdominfobyname, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Query LSA trusted domains info (given a name), only works for Windows > 2k", "" }, 2231 { "lsaquerytrustdominfobysid",RPC_RTYPE_NTSTATUS, cmd_lsa_query_trustdominfobysid, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Query LSA trusted domains info (given a SID)", "" }, 2232 { "getusername", RPC_RTYPE_NTSTATUS, cmd_lsa_get_username, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Get username", "" }, 2233 { "createsecret", RPC_RTYPE_NTSTATUS, cmd_lsa_create_secret, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Create Secret", "" }, 2234 { "deletesecret", RPC_RTYPE_NTSTATUS, cmd_lsa_delete_secret, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Delete Secret", "" }, 2235 { "querysecret", RPC_RTYPE_NTSTATUS, cmd_lsa_query_secret, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Query Secret", "" }, 2236 { "setsecret", RPC_RTYPE_NTSTATUS, cmd_lsa_set_secret, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Set Secret", "" }, 2237 { "retrieveprivatedata", RPC_RTYPE_NTSTATUS, cmd_lsa_retrieve_private_data, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Retrieve Private Data", "" }, 2238 { "storeprivatedata", RPC_RTYPE_NTSTATUS, cmd_lsa_store_private_data, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Store Private Data", "" }, 2239 { "createtrustdom", RPC_RTYPE_NTSTATUS, cmd_lsa_create_trusted_domain, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Create Trusted Domain", "" }, 2240 { "deletetrustdom", RPC_RTYPE_NTSTATUS, cmd_lsa_delete_trusted_domain, NULL, &ndr_table_lsarpc.syntax_id, NULL, "Delete Trusted Domain", "" }, 2279 { "lsaquery", RPC_RTYPE_NTSTATUS, cmd_lsa_query_info_policy, NULL, &ndr_table_lsarpc, NULL, "Query info policy", "" }, 2280 { "lookupsids", RPC_RTYPE_NTSTATUS, cmd_lsa_lookup_sids, NULL, &ndr_table_lsarpc, NULL, "Convert SIDs to names", "" }, 2281 { "lookupsids3", RPC_RTYPE_NTSTATUS, cmd_lsa_lookup_sids3, NULL, &ndr_table_lsarpc, NULL, "Convert SIDs to names", "" }, 2282 { "lookupnames", RPC_RTYPE_NTSTATUS, cmd_lsa_lookup_names, NULL, &ndr_table_lsarpc, NULL, "Convert names to SIDs", "" }, 2283 { "lookupnames4", RPC_RTYPE_NTSTATUS, cmd_lsa_lookup_names4, NULL, &ndr_table_lsarpc, NULL, "Convert names to SIDs", "" }, 2284 { "lookupnames_level", RPC_RTYPE_NTSTATUS, cmd_lsa_lookup_names_level, NULL, &ndr_table_lsarpc, NULL, "Convert names to SIDs", "" }, 2285 { "enumtrust", RPC_RTYPE_NTSTATUS, cmd_lsa_enum_trust_dom, NULL, &ndr_table_lsarpc, NULL, "Enumerate trusted domains", "Usage: [preferred max number] [enum context (0)]" }, 2286 { "enumprivs", RPC_RTYPE_NTSTATUS, cmd_lsa_enum_privilege, NULL, &ndr_table_lsarpc, NULL, "Enumerate privileges", "" }, 2287 { "getdispname", RPC_RTYPE_NTSTATUS, cmd_lsa_get_dispname, NULL, &ndr_table_lsarpc, NULL, "Get the privilege name", "" }, 2288 { "lsaenumsid", RPC_RTYPE_NTSTATUS, cmd_lsa_enum_sids, NULL, &ndr_table_lsarpc, NULL, "Enumerate the LSA SIDS", "" }, 2289 { "lsacreateaccount", RPC_RTYPE_NTSTATUS, cmd_lsa_create_account, NULL, &ndr_table_lsarpc, NULL, "Create a new lsa account", "" }, 2290 { "lsaenumprivsaccount", RPC_RTYPE_NTSTATUS, cmd_lsa_enum_privsaccounts, NULL, &ndr_table_lsarpc, NULL, "Enumerate the privileges of an SID", "" }, 2291 { "lsaenumacctrights", RPC_RTYPE_NTSTATUS, cmd_lsa_enum_acct_rights, NULL, &ndr_table_lsarpc, NULL, "Enumerate the rights of an SID", "" }, 2292 { "lsaaddpriv", RPC_RTYPE_NTSTATUS, cmd_lsa_add_priv, NULL, &ndr_table_lsarpc, NULL, "Assign a privilege to a SID", "" }, 2293 { "lsadelpriv", RPC_RTYPE_NTSTATUS, cmd_lsa_del_priv, NULL, &ndr_table_lsarpc, NULL, "Revoke a privilege from a SID", "" }, 2294 { "lsaaddacctrights", RPC_RTYPE_NTSTATUS, cmd_lsa_add_acct_rights, NULL, &ndr_table_lsarpc, NULL, "Add rights to an account", "" }, 2295 { "lsaremoveacctrights", RPC_RTYPE_NTSTATUS, cmd_lsa_remove_acct_rights, NULL, &ndr_table_lsarpc, NULL, "Remove rights from an account", "" }, 2296 { "lsalookupprivvalue", RPC_RTYPE_NTSTATUS, cmd_lsa_lookup_priv_value, NULL, &ndr_table_lsarpc, NULL, "Get a privilege value given its name", "" }, 2297 { "lsaquerysecobj", RPC_RTYPE_NTSTATUS, cmd_lsa_query_secobj, NULL, &ndr_table_lsarpc, NULL, "Query LSA security object", "" }, 2298 { "lsaquerytrustdominfo",RPC_RTYPE_NTSTATUS, cmd_lsa_query_trustdominfo, NULL, &ndr_table_lsarpc, NULL, "Query LSA trusted domains info (given a SID)", "" }, 2299 { "lsaquerytrustdominfobyname",RPC_RTYPE_NTSTATUS, cmd_lsa_query_trustdominfobyname, NULL, &ndr_table_lsarpc, NULL, "Query LSA trusted domains info (given a name), only works for Windows > 2k", "" }, 2300 { "lsaquerytrustdominfobysid",RPC_RTYPE_NTSTATUS, cmd_lsa_query_trustdominfobysid, NULL, &ndr_table_lsarpc, NULL, "Query LSA trusted domains info (given a SID)", "" }, 2301 { "lsasettrustdominfo", RPC_RTYPE_NTSTATUS, cmd_lsa_set_trustdominfo, NULL, &ndr_table_lsarpc, NULL, "Set LSA trusted domain info", "" }, 2302 { "getusername", RPC_RTYPE_NTSTATUS, cmd_lsa_get_username, NULL, &ndr_table_lsarpc, NULL, "Get username", "" }, 2303 { "createsecret", RPC_RTYPE_NTSTATUS, cmd_lsa_create_secret, NULL, &ndr_table_lsarpc, NULL, "Create Secret", "" }, 2304 { "deletesecret", RPC_RTYPE_NTSTATUS, cmd_lsa_delete_secret, NULL, &ndr_table_lsarpc, NULL, "Delete Secret", "" }, 2305 { "querysecret", RPC_RTYPE_NTSTATUS, cmd_lsa_query_secret, NULL, &ndr_table_lsarpc, NULL, "Query Secret", "" }, 2306 { "setsecret", RPC_RTYPE_NTSTATUS, cmd_lsa_set_secret, NULL, &ndr_table_lsarpc, NULL, "Set Secret", "" }, 2307 { "retrieveprivatedata", RPC_RTYPE_NTSTATUS, cmd_lsa_retrieve_private_data, NULL, &ndr_table_lsarpc, NULL, "Retrieve Private Data", "" }, 2308 { "storeprivatedata", RPC_RTYPE_NTSTATUS, cmd_lsa_store_private_data, NULL, &ndr_table_lsarpc, NULL, "Store Private Data", "" }, 2309 { "createtrustdom", RPC_RTYPE_NTSTATUS, cmd_lsa_create_trusted_domain, NULL, &ndr_table_lsarpc, NULL, "Create Trusted Domain", "" }, 2310 { "deletetrustdom", RPC_RTYPE_NTSTATUS, cmd_lsa_delete_trusted_domain, NULL, &ndr_table_lsarpc, NULL, "Delete Trusted Domain", "" }, 2241 2311 2242 2312 { NULL } -
vendor/current/source3/rpcclient/cmd_netlogon.c
r740 r988 27 27 #include "rpc_client/cli_netlogon.h" 28 28 #include "secrets.h" 29 #include "../libcli/auth/netlogon_creds_cli.h" 29 30 30 31 static WERROR cmd_netlogon_logon_ctrl2(struct rpc_pipe_client *cli, … … 41 42 const char *domain = lp_workgroup(); 42 43 struct dcerpc_binding_handle *b = cli->binding_handle; 43 44 if (argc > 5) { 44 int i; 45 #define fn_code_level(x, item) { x, #x, #item } 46 struct { 47 enum netr_LogonControlCode code; 48 const char *name; 49 const char *argument; 50 } supported_levels[] = { 51 fn_code_level(NETLOGON_CONTROL_REDISCOVER, domain), 52 fn_code_level(NETLOGON_CONTROL_TC_QUERY, domain), 53 fn_code_level(NETLOGON_CONTROL_TRANSPORT_NOTIFY, domain), 54 fn_code_level(NETLOGON_CONTROL_FIND_USER, user), 55 fn_code_level(NETLOGON_CONTROL_CHANGE_PASSWORD, domain), 56 fn_code_level(NETLOGON_CONTROL_TC_VERIFY, domain), 57 fn_code_level(NETLOGON_CONTROL_SET_DBFLAG, debug_level), 58 {0, 0, 0} 59 }; 60 #undef fn_code_level 61 if ((argc > 5) || (argc < 2)) { 45 62 fprintf(stderr, "Usage: %s <logon_server> <function_code> " 46 "<level> <domain>\n", argv[0]); 63 "<level:1..4> <argument>\n", argv[0]); 64 fprintf(stderr, "Supported combinations:\n"); 65 fprintf(stderr, "function_code\targument\n"); 66 for(i=0; supported_levels[i].code; i++) { 67 fprintf(stderr, "%7d\t\t%s\t(%s)\n", 68 supported_levels[i].code, 69 supported_levels[i].argument, 70 supported_levels[i].name); 71 } 47 72 return WERR_OK; 48 73 } … … 67 92 case NETLOGON_CONTROL_REDISCOVER: 68 93 case NETLOGON_CONTROL_TC_QUERY: 94 case NETLOGON_CONTROL_CHANGE_PASSWORD: 95 case NETLOGON_CONTROL_TRANSPORT_NOTIFY: 96 case NETLOGON_CONTROL_TC_VERIFY: 69 97 data.domain = domain; 70 98 break; 99 case NETLOGON_CONTROL_FIND_USER: 100 data.user = domain; 101 break; 102 case NETLOGON_CONTROL_SET_DBFLAG: 103 data.debug_level = atoi(domain); 71 104 default: 72 105 break; … … 181 214 NTSTATUS result; 182 215 WERROR werr = WERR_OK; 183 uint32 flags = DS_RETURN_DNS_NAME;216 uint32_t flags = DS_RETURN_DNS_NAME; 184 217 const char *server_name = cli->desthost; 185 218 const char *domain_name; … … 212 245 if (argc >= 5) 213 246 sscanf(argv[4], "%x", &flags); 214 215 debug_dsdcinfo_flags(1,flags);216 247 217 248 result = dcerpc_netr_DsRGetDCName(b, mem_ctx, … … 275 306 } 276 307 277 debug_dsdcinfo_flags(1,flags);278 279 308 status = dcerpc_netr_DsRGetDCNameEx(b, mem_ctx, 280 309 server_name, … … 348 377 } 349 378 350 debug_dsdcinfo_flags(1,flags);351 352 379 status = dcerpc_netr_DsRGetDCNameEx2(b, mem_ctx, 353 380 server_name, … … 584 611 NTSTATUS status; 585 612 const char *logon_server = cli->desthost; 586 const char *computername = global_myname();613 const char *computername = lp_netbios_name(); 587 614 struct netr_Authenticator credential; 588 615 struct netr_Authenticator return_authenticator; … … 605 632 do { 606 633 struct netr_DELTA_ENUM_ARRAY *delta_enum_array = NULL; 607 608 netlogon_creds_client_authenticator(cli->dc, &credential); 634 struct netlogon_creds_CredentialState *creds = NULL; 635 636 if (rpcclient_netlogon_creds == NULL) { 637 return NT_STATUS_UNSUCCESSFUL; 638 } 639 640 status = netlogon_creds_cli_lock(rpcclient_netlogon_creds, 641 mem_ctx, &creds); 642 if (!NT_STATUS_IS_OK(status)) { 643 return status; 644 } 645 646 netlogon_creds_client_authenticator(creds, &credential); 609 647 610 648 status = dcerpc_netr_DatabaseSync2(b, mem_ctx, … … 620 658 &result); 621 659 if (!NT_STATUS_IS_OK(status)) { 660 TALLOC_FREE(creds); 622 661 return status; 623 662 } 624 663 625 664 /* Check returned credentials. */ 626 if (!netlogon_creds_client_check(c li->dc,665 if (!netlogon_creds_client_check(creds, 627 666 &return_authenticator.cred)) { 628 667 DEBUG(0,("credentials chain check failed\n")); 668 TALLOC_FREE(creds); 629 669 return NT_STATUS_ACCESS_DENIED; 630 670 } 671 TALLOC_FREE(creds); 631 672 632 673 if (NT_STATUS_IS_ERR(result)) { … … 655 696 uint32_t tmp; 656 697 const char *logon_server = cli->desthost; 657 const char *computername = global_myname();698 const char *computername = lp_netbios_name(); 658 699 struct netr_Authenticator credential; 659 700 struct netr_Authenticator return_authenticator; … … 674 715 do { 675 716 struct netr_DELTA_ENUM_ARRAY *delta_enum_array = NULL; 676 677 netlogon_creds_client_authenticator(cli->dc, &credential); 717 struct netlogon_creds_CredentialState *creds = NULL; 718 719 if (rpcclient_netlogon_creds == NULL) { 720 return NT_STATUS_UNSUCCESSFUL; 721 } 722 723 status = netlogon_creds_cli_lock(rpcclient_netlogon_creds, 724 mem_ctx, &creds); 725 if (!NT_STATUS_IS_OK(status)) { 726 return status; 727 } 728 729 netlogon_creds_client_authenticator(creds, &credential); 678 730 679 731 status = dcerpc_netr_DatabaseDeltas(b, mem_ctx, … … 688 740 &result); 689 741 if (!NT_STATUS_IS_OK(status)) { 742 TALLOC_FREE(creds); 690 743 return status; 691 744 } 692 745 693 746 /* Check returned credentials. */ 694 if (!netlogon_creds_client_check(c li->dc,747 if (!netlogon_creds_client_check(creds, 695 748 &return_authenticator.cred)) { 696 749 DEBUG(0,("credentials chain check failed\n")); 750 TALLOC_FREE(creds); 697 751 return NT_STATUS_ACCESS_DENIED; 698 752 } 753 TALLOC_FREE(creds); 699 754 700 755 if (NT_STATUS_IS_ERR(result)) { … … 722 777 int logon_type = NetlogonNetworkInformation; 723 778 const char *username, *password; 724 uint16_t validation_level = 3; 725 uint32 logon_param = 0; 779 uint32_t logon_param = 0; 726 780 const char *workstation = NULL; 781 struct netr_SamInfo3 *info3 = NULL; 727 782 728 783 /* Check arguments */ 729 784 730 if (argc < 3 || argc > 7) {785 if (argc < 3 || argc > 6) { 731 786 fprintf(stderr, "Usage: samlogon <username> <password> [workstation]" 732 "[logon_type (1 or 2)] [ auth level (2 or 3)] [logon_parameter]\n");787 "[logon_type (1 or 2)] [logon_parameter]\n"); 733 788 return NT_STATUS_OK; 734 789 } … … 743 798 sscanf(argv[4], "%i", &logon_type); 744 799 745 if (argc >= 6) 746 validation_level = atoi(argv[5]); 747 748 if (argc == 7) 749 sscanf(argv[6], "%x", &logon_param); 800 if (argc == 6) 801 sscanf(argv[5], "%x", &logon_param); 802 803 if (rpcclient_netlogon_creds == NULL) { 804 result = NT_STATUS_UNSUCCESSFUL; 805 goto done; 806 } 750 807 751 808 /* Perform the sam logon */ 752 809 753 result = rpccli_netlogon_sam_logon(cli, mem_ctx, logon_param, lp_workgroup(), username, password, workstation, validation_level, logon_type); 754 810 result = rpccli_netlogon_password_logon(rpcclient_netlogon_creds, 811 cli->binding_handle, 812 mem_ctx, 813 logon_param, 814 lp_workgroup(), 815 username, 816 password, 817 workstation, 818 logon_type, 819 &info3); 755 820 if (!NT_STATUS_IS_OK(result)) 756 821 goto done; … … 775 840 } 776 841 777 /* Perform the sam logon */ 778 779 result = trust_pw_find_change_and_store_it(cli, mem_ctx,780 lp_workgroup());781 842 result = trust_pw_change(rpcclient_netlogon_creds, 843 rpcclient_msg_ctx, 844 cli->binding_handle, 845 lp_workgroup(), 846 true); /* force */ 782 847 if (!NT_STATUS_IS_OK(result)) 783 848 goto done; … … 1095 1160 NTSTATUS result; 1096 1161 const char *server_name = cli->desthost; 1097 uint32_t neg_flags = NETLOGON_NEG_AUTH2_ADS_FLAGS;1098 1162 struct netr_Authenticator clnt_creds, srv_cred; 1099 1163 struct netr_DELTA_ENUM_ARRAY *delta_enum_array = NULL; 1100 unsigned char trust_passwd_hash[16];1101 enum netr_SchannelType sec_channel_type = 0;1102 1164 struct netr_ChangeLogEntry e; 1103 1165 uint32_t rid = 500; 1104 1166 struct dcerpc_binding_handle *b = cli->binding_handle; 1167 struct netlogon_creds_CredentialState *creds = NULL; 1105 1168 1106 1169 if (argc > 2) { … … 1113 1176 } 1114 1177 1115 if (!secrets_fetch_trust_account_password(lp_workgroup(), 1116 trust_passwd_hash, 1117 NULL, &sec_channel_type)) { 1178 if (rpcclient_netlogon_creds == NULL) { 1118 1179 return NT_STATUS_UNSUCCESSFUL; 1119 1180 } 1120 1181 1121 status = rpccli_netlogon_setup_creds(cli, 1122 server_name, /* server name */ 1123 lp_workgroup(), /* domain */ 1124 global_myname(), /* client name */ 1125 global_myname(), /* machine account name */ 1126 trust_passwd_hash, 1127 sec_channel_type, 1128 &neg_flags); 1129 1182 status = netlogon_creds_cli_lock(rpcclient_netlogon_creds, 1183 mem_ctx, &creds); 1130 1184 if (!NT_STATUS_IS_OK(status)) { 1131 1185 return status; 1132 1186 } 1133 1187 1134 netlogon_creds_client_authenticator(c li->dc, &clnt_creds);1188 netlogon_creds_client_authenticator(creds, &clnt_creds); 1135 1189 1136 1190 ZERO_STRUCT(e); … … 1142 1196 status = dcerpc_netr_DatabaseRedo(b, mem_ctx, 1143 1197 server_name, 1144 global_myname(),1198 lp_netbios_name(), 1145 1199 &clnt_creds, 1146 1200 &srv_cred, … … 1150 1204 &result); 1151 1205 if (!NT_STATUS_IS_OK(status)) { 1206 TALLOC_FREE(creds); 1152 1207 return status; 1153 1208 } 1154 1209 1155 if (!netlogon_creds_client_check(c li->dc, &srv_cred.cred)) {1210 if (!netlogon_creds_client_check(creds, &srv_cred.cred)) { 1156 1211 DEBUG(0,("credentials chain check failed\n")); 1212 TALLOC_FREE(creds); 1157 1213 return NT_STATUS_ACCESS_DENIED; 1158 1214 } 1215 TALLOC_FREE(creds); 1159 1216 1160 1217 return result; … … 1172 1229 uint32_t level = 1; 1173 1230 struct dcerpc_binding_handle *b = cli->binding_handle; 1231 struct netlogon_creds_CredentialState *creds = NULL; 1174 1232 1175 1233 if (argc > 2) { … … 1184 1242 ZERO_STRUCT(return_authenticator); 1185 1243 1186 netlogon_creds_client_authenticator(cli->dc, &credential); 1244 if (rpcclient_netlogon_creds == NULL) { 1245 return NT_STATUS_UNSUCCESSFUL; 1246 } 1247 1248 status = netlogon_creds_cli_lock(rpcclient_netlogon_creds, 1249 mem_ctx, &creds); 1250 if (!NT_STATUS_IS_OK(status)) { 1251 return status; 1252 } 1253 1254 netlogon_creds_client_authenticator(creds, &credential); 1187 1255 1188 1256 status = dcerpc_netr_LogonGetCapabilities(b, mem_ctx, 1189 1257 cli->desthost, 1190 global_myname(),1258 lp_netbios_name(), 1191 1259 &credential, 1192 1260 &return_authenticator, … … 1195 1263 &result); 1196 1264 if (!NT_STATUS_IS_OK(status)) { 1265 TALLOC_FREE(creds); 1197 1266 return status; 1198 1267 } 1199 1268 1200 if (!netlogon_creds_client_check(c li->dc,1269 if (!netlogon_creds_client_check(creds, 1201 1270 &return_authenticator.cred)) { 1202 1271 DEBUG(0,("credentials chain check failed\n")); 1272 TALLOC_FREE(creds); 1203 1273 return NT_STATUS_ACCESS_DENIED; 1204 1274 } 1275 TALLOC_FREE(creds); 1205 1276 1206 1277 printf("capabilities: 0x%08x\n", capabilities.server_capabilities); … … 1215 1286 { "NETLOGON" }, 1216 1287 1217 { "logonctrl2", RPC_RTYPE_WERROR, NULL, cmd_netlogon_logon_ctrl2, &ndr_table_netlogon .syntax_id, NULL, "Logon Control 2", "" },1218 { "getanydcname", RPC_RTYPE_WERROR, NULL, cmd_netlogon_getanydcname, &ndr_table_netlogon .syntax_id, NULL, "Get trusted DC name", "" },1219 { "getdcname", RPC_RTYPE_WERROR, NULL, cmd_netlogon_getdcname, &ndr_table_netlogon .syntax_id, NULL, "Get trusted PDC name", "" },1220 { "dsr_getdcname", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getdcname, &ndr_table_netlogon .syntax_id, NULL, "Get trusted DC name", "" },1221 { "dsr_getdcnameex", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getdcnameex, &ndr_table_netlogon .syntax_id, NULL, "Get trusted DC name", "" },1222 { "dsr_getdcnameex2", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getdcnameex2, &ndr_table_netlogon .syntax_id, NULL, "Get trusted DC name", "" },1223 { "dsr_getsitename", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getsitename, &ndr_table_netlogon .syntax_id, NULL, "Get sitename", "" },1224 { "dsr_getforesttrustinfo", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getforesttrustinfo, &ndr_table_netlogon .syntax_id, NULL, "Get Forest Trust Info", "" },1225 { "logonctrl", RPC_RTYPE_WERROR, NULL, cmd_netlogon_logon_ctrl, &ndr_table_netlogon .syntax_id, NULL, "Logon Control", "" },1226 { "samsync", RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_sync, NULL, &ndr_table_netlogon .syntax_id, NULL, "Sam Synchronisation", ""},1227 { "samdeltas", RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_deltas, NULL, &ndr_table_netlogon .syntax_id, NULL, "Query Sam Deltas", ""},1228 { "samlogon", RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_logon, NULL, &ndr_table_netlogon .syntax_id, NULL, "Sam Logon", ""},1229 { "change_trust_pw", RPC_RTYPE_NTSTATUS, cmd_netlogon_change_trust_pw, NULL, &ndr_table_netlogon .syntax_id, NULL, "Change Trust Account Password", ""},1230 { "gettrustrid", RPC_RTYPE_WERROR, NULL, cmd_netlogon_gettrustrid, &ndr_table_netlogon .syntax_id, NULL, "Get trust rid", "" },1231 { "dsr_enumtrustdom", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_enumtrustdom, &ndr_table_netlogon .syntax_id, NULL, "Enumerate trusted domains", "" },1232 { "dsenumdomtrusts", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_enumtrustdom, &ndr_table_netlogon .syntax_id, NULL, "Enumerate all trusted domains in an AD forest", "" },1233 { "deregisterdnsrecords", RPC_RTYPE_WERROR, NULL, cmd_netlogon_deregisterdnsrecords, &ndr_table_netlogon .syntax_id, NULL, "Deregister DNS records", "" },1234 { "netrenumtrusteddomains", RPC_RTYPE_NTSTATUS, cmd_netlogon_enumtrusteddomains, NULL, &ndr_table_netlogon .syntax_id, NULL, "Enumerate trusted domains", "" },1235 { "netrenumtrusteddomainsex", RPC_RTYPE_WERROR, NULL, cmd_netlogon_enumtrusteddomainsex, &ndr_table_netlogon .syntax_id, NULL, "Enumerate trusted domains", "" },1236 { "getdcsitecoverage", RPC_RTYPE_WERROR, NULL, cmd_netlogon_getdcsitecoverage, &ndr_table_netlogon .syntax_id, NULL, "Get the Site-Coverage from a DC", "" },1237 { "database_redo", RPC_RTYPE_NTSTATUS, cmd_netlogon_database_redo, NULL, &ndr_table_netlogon .syntax_id, NULL, "Replicate single object from a DC", ""},1238 { "capabilities", RPC_RTYPE_NTSTATUS, cmd_netlogon_capabilities, NULL, &ndr_table_netlogon .syntax_id, NULL, "Return Capabilities", ""},1288 { "logonctrl2", RPC_RTYPE_WERROR, NULL, cmd_netlogon_logon_ctrl2, &ndr_table_netlogon, NULL, "Logon Control 2", "" }, 1289 { "getanydcname", RPC_RTYPE_WERROR, NULL, cmd_netlogon_getanydcname, &ndr_table_netlogon, NULL, "Get trusted DC name", "" }, 1290 { "getdcname", RPC_RTYPE_WERROR, NULL, cmd_netlogon_getdcname, &ndr_table_netlogon, NULL, "Get trusted PDC name", "" }, 1291 { "dsr_getdcname", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getdcname, &ndr_table_netlogon, NULL, "Get trusted DC name", "" }, 1292 { "dsr_getdcnameex", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getdcnameex, &ndr_table_netlogon, NULL, "Get trusted DC name", "" }, 1293 { "dsr_getdcnameex2", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getdcnameex2, &ndr_table_netlogon, NULL, "Get trusted DC name", "" }, 1294 { "dsr_getsitename", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getsitename, &ndr_table_netlogon, NULL, "Get sitename", "" }, 1295 { "dsr_getforesttrustinfo", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getforesttrustinfo, &ndr_table_netlogon, NULL, "Get Forest Trust Info", "" }, 1296 { "logonctrl", RPC_RTYPE_WERROR, NULL, cmd_netlogon_logon_ctrl, &ndr_table_netlogon, NULL, "Logon Control", "" }, 1297 { "samsync", RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_sync, NULL, &ndr_table_netlogon, NULL, "Sam Synchronisation", "", .use_netlogon_creds = true, }, 1298 { "samdeltas", RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_deltas, NULL, &ndr_table_netlogon, NULL, "Query Sam Deltas", "", .use_netlogon_creds = true, }, 1299 { "samlogon", RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_logon, NULL, &ndr_table_netlogon, NULL, "Sam Logon", "", .use_netlogon_creds = true, }, 1300 { "change_trust_pw", RPC_RTYPE_NTSTATUS, cmd_netlogon_change_trust_pw, NULL, &ndr_table_netlogon, NULL, "Change Trust Account Password", "", .use_netlogon_creds = true, }, 1301 { "gettrustrid", RPC_RTYPE_WERROR, NULL, cmd_netlogon_gettrustrid, &ndr_table_netlogon, NULL, "Get trust rid", "" }, 1302 { "dsr_enumtrustdom", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_enumtrustdom, &ndr_table_netlogon, NULL, "Enumerate trusted domains", "" }, 1303 { "dsenumdomtrusts", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_enumtrustdom, &ndr_table_netlogon, NULL, "Enumerate all trusted domains in an AD forest", "" }, 1304 { "deregisterdnsrecords", RPC_RTYPE_WERROR, NULL, cmd_netlogon_deregisterdnsrecords, &ndr_table_netlogon, NULL, "Deregister DNS records", "" }, 1305 { "netrenumtrusteddomains", RPC_RTYPE_NTSTATUS, cmd_netlogon_enumtrusteddomains, NULL, &ndr_table_netlogon, NULL, "Enumerate trusted domains", "" }, 1306 { "netrenumtrusteddomainsex", RPC_RTYPE_WERROR, NULL, cmd_netlogon_enumtrusteddomainsex, &ndr_table_netlogon, NULL, "Enumerate trusted domains", "" }, 1307 { "getdcsitecoverage", RPC_RTYPE_WERROR, NULL, cmd_netlogon_getdcsitecoverage, &ndr_table_netlogon, NULL, "Get the Site-Coverage from a DC", "" }, 1308 { "database_redo", RPC_RTYPE_NTSTATUS, cmd_netlogon_database_redo, NULL, &ndr_table_netlogon, NULL, "Replicate single object from a DC", "", .use_netlogon_creds = true, }, 1309 { "capabilities", RPC_RTYPE_NTSTATUS, cmd_netlogon_capabilities, NULL, &ndr_table_netlogon, NULL, "Return Capabilities", "", .use_netlogon_creds = true, }, 1239 1310 1240 1311 { NULL } -
vendor/current/source3/rpcclient/cmd_ntsvcs.c
r740 r988 284 284 285 285 { "NTSVCS" }, 286 { "ntsvcs_getversion", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_get_version, &ndr_table_ntsvcs .syntax_id, NULL, "Query NTSVCS version", "" },287 { "ntsvcs_validatedevinst", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_validate_dev_inst, &ndr_table_ntsvcs .syntax_id, NULL, "Query NTSVCS device instance", "" },288 { "ntsvcs_hwprofflags", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_hw_prof_flags, &ndr_table_ntsvcs .syntax_id, NULL, "Query NTSVCS HW prof flags", "" },289 { "ntsvcs_hwprofinfo", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_get_hw_prof_info, &ndr_table_ntsvcs .syntax_id, NULL, "Query NTSVCS HW prof info", "" },290 { "ntsvcs_getdevregprop", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_get_dev_reg_prop, &ndr_table_ntsvcs .syntax_id, NULL, "Query NTSVCS device registry property", "" },291 { "ntsvcs_getdevlistsize", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_get_dev_list_size, &ndr_table_ntsvcs .syntax_id, NULL, "Query NTSVCS device list size", "" },292 { "ntsvcs_getdevlist", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_get_dev_list, &ndr_table_ntsvcs .syntax_id, NULL, "Query NTSVCS device list", "" },286 { "ntsvcs_getversion", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_get_version, &ndr_table_ntsvcs, NULL, "Query NTSVCS version", "" }, 287 { "ntsvcs_validatedevinst", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_validate_dev_inst, &ndr_table_ntsvcs, NULL, "Query NTSVCS device instance", "" }, 288 { "ntsvcs_hwprofflags", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_hw_prof_flags, &ndr_table_ntsvcs, NULL, "Query NTSVCS HW prof flags", "" }, 289 { "ntsvcs_hwprofinfo", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_get_hw_prof_info, &ndr_table_ntsvcs, NULL, "Query NTSVCS HW prof info", "" }, 290 { "ntsvcs_getdevregprop", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_get_dev_reg_prop, &ndr_table_ntsvcs, NULL, "Query NTSVCS device registry property", "" }, 291 { "ntsvcs_getdevlistsize", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_get_dev_list_size, &ndr_table_ntsvcs, NULL, "Query NTSVCS device list size", "" }, 292 { "ntsvcs_getdevlist", RPC_RTYPE_WERROR, NULL, cmd_ntsvcs_get_dev_list, &ndr_table_ntsvcs, NULL, "Query NTSVCS device list", "" }, 293 293 { NULL } 294 294 }; -
vendor/current/source3/rpcclient/cmd_samr.c
r860 r988 285 285 NTSTATUS status = NT_STATUS_INVALID_PARAMETER, result; 286 286 287 if ( StrCaseCmp(sam, "domain") == 0) {287 if (strcasecmp_m(sam, "domain") == 0) { 288 288 status = dcerpc_samr_OpenDomain(b, mem_ctx, 289 289 connect_pol, … … 292 292 domain_pol, 293 293 &result); 294 } else if ( StrCaseCmp(sam, "builtin") == 0) {294 } else if (strcasecmp_m(sam, "builtin") == 0) { 295 295 status = dcerpc_samr_OpenDomain(b, mem_ctx, 296 296 connect_pol, 297 297 access_mask, 298 CONST_DISCARD(struct dom_sid2 *, &global_sid_Builtin),298 discard_const_p(struct dom_sid2, &global_sid_Builtin), 299 299 domain_pol, 300 300 &result); … … 317 317 struct policy_handle connect_pol, domain_pol, user_pol; 318 318 NTSTATUS status, result; 319 uint32 info_level = 21;320 uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;319 uint32_t info_level = 21; 320 uint32_t access_mask = MAXIMUM_ALLOWED_ACCESS; 321 321 union samr_UserInfo *info = NULL; 322 uint32 user_rid = 0;322 uint32_t user_rid = 0; 323 323 struct dcerpc_binding_handle *b = cli->binding_handle; 324 324 … … 540 540 NTSTATUS status, result; 541 541 enum samr_GroupInfoEnum info_level = GROUPINFOALL; 542 uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;542 uint32_t access_mask = MAXIMUM_ALLOWED_ACCESS; 543 543 union samr_GroupInfo *group_info = NULL; 544 uint32 group_rid;544 uint32_t group_rid; 545 545 struct dcerpc_binding_handle *b = cli->binding_handle; 546 546 … … 625 625 user_pol; 626 626 NTSTATUS status, result; 627 uint32 628 uint32 627 uint32_t user_rid; 628 uint32_t access_mask = MAXIMUM_ALLOWED_ACCESS; 629 629 int i; 630 630 struct samr_RidWithAttributeArray *rid_array = NULL; … … 711 711 NTSTATUS status, result; 712 712 struct dom_sid *sids; 713 uint32_t 714 uint32 713 uint32_t num_sids; 714 uint32_t access_mask = MAXIMUM_ALLOWED_ACCESS; 715 715 int i; 716 716 struct lsa_SidArray sid_array; … … 739 739 740 740 if (num_sids) { 741 sid_array.sids = TALLOC_ZERO_ARRAY(mem_ctx, struct lsa_SidPtr, num_sids);741 sid_array.sids = talloc_zero_array(mem_ctx, struct lsa_SidPtr, num_sids); 742 742 if (sid_array.sids == NULL) 743 743 return NT_STATUS_NO_MEMORY; … … 802 802 struct policy_handle connect_pol, domain_pol, group_pol; 803 803 NTSTATUS status, result; 804 uint32 group_rid;805 uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;804 uint32_t group_rid; 805 uint32_t access_mask = MAXIMUM_ALLOWED_ACCESS; 806 806 int i; 807 807 unsigned int old_timeout; … … 891 891 int argc, const char **argv) 892 892 { 893 struct policy_handle connect_pol, domain_pol; 893 struct policy_handle connect_pol; 894 struct policy_handle domain_pol = { 0, }; 894 895 NTSTATUS status, result; 895 uint32 start_idx, num_dom_users, i;896 uint32_t start_idx, num_dom_users, i; 896 897 struct samr_SamArray *dom_users = NULL; 897 uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;898 uint32 acb_mask = ACB_NORMAL;898 uint32_t access_mask = MAXIMUM_ALLOWED_ACCESS; 899 uint32_t acb_mask = ACB_NORMAL; 899 900 uint32_t size = 0xffff; 900 901 struct dcerpc_binding_handle *b = cli->binding_handle; … … 980 981 int argc, const char **argv) 981 982 { 982 struct policy_handle connect_pol, domain_pol; 983 struct policy_handle connect_pol; 984 struct policy_handle domain_pol = { 0, }; 983 985 NTSTATUS status, result; 984 uint32 start_idx, num_dom_groups, i;985 uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;986 uint32_t start_idx, num_dom_groups, i; 987 uint32_t access_mask = MAXIMUM_ALLOWED_ACCESS; 986 988 struct samr_SamArray *dom_groups = NULL; 987 989 uint32_t size = 0xffff; … … 1063 1065 int argc, const char **argv) 1064 1066 { 1065 struct policy_handle connect_pol, domain_pol; 1067 struct policy_handle connect_pol; 1068 struct policy_handle domain_pol = { 0, }; 1066 1069 NTSTATUS status, result; 1067 uint32 start_idx, num_als_groups, i;1068 uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;1070 uint32_t start_idx, num_als_groups, i; 1071 uint32_t access_mask = MAXIMUM_ALLOWED_ACCESS; 1069 1072 struct samr_SamArray *als_groups = NULL; 1070 1073 uint32_t size = 0xffff; … … 1147 1150 struct policy_handle connect_pol; 1148 1151 NTSTATUS status, result; 1149 uint32 start_idx, size, num_entries, i;1150 uint32 access_mask = SEC_FLAG_MAXIMUM_ALLOWED;1152 uint32_t start_idx, size, num_entries, i; 1153 uint32_t access_mask = SEC_FLAG_MAXIMUM_ALLOWED; 1151 1154 struct samr_SamArray *sam = NULL; 1152 1155 struct dcerpc_binding_handle *b = cli->binding_handle; … … 1213 1216 struct policy_handle connect_pol, domain_pol, alias_pol; 1214 1217 NTSTATUS status, result; 1215 uint32 alias_rid, i;1216 uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;1218 uint32_t alias_rid, i; 1219 uint32_t access_mask = MAXIMUM_ALLOWED_ACCESS; 1217 1220 struct lsa_SidArray sid_array; 1218 1221 struct dcerpc_binding_handle *b = cli->binding_handle; … … 1401 1404 struct policy_handle connect_pol, domain_pol, alias_pol; 1402 1405 NTSTATUS status, result; 1403 uint32 alias_rid;1404 uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;1406 uint32_t alias_rid; 1407 uint32_t access_mask = MAXIMUM_ALLOWED_ACCESS; 1405 1408 struct dcerpc_binding_handle *b = cli->binding_handle; 1406 1409 … … 1508 1511 struct policy_handle connect_pol, domain_pol; 1509 1512 NTSTATUS status, result; 1510 uint32 start_idx=0, max_entries=250, max_size = 0xffff, num_entries = 0, i;1511 uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;1512 uint32 info_level = 1;1513 uint32_t start_idx=0, max_entries=250, max_size = 0xffff, num_entries = 0, i; 1514 uint32_t access_mask = MAXIMUM_ALLOWED_ACCESS; 1515 uint32_t info_level = 1; 1513 1516 union samr_DispInfo info; 1514 1517 int loop_count = 0; … … 1713 1716 struct policy_handle connect_pol, domain_pol; 1714 1717 NTSTATUS status, result; 1715 uint32 switch_level = 2;1716 uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;1718 uint32_t switch_level = 2; 1719 uint32_t access_mask = MAXIMUM_ALLOWED_ACCESS; 1717 1720 union samr_DomainInfo *info = NULL; 1718 1721 struct dcerpc_binding_handle *b = cli->binding_handle; … … 1828 1831 NTSTATUS status, result; 1829 1832 struct lsa_String acct_name; 1830 uint32 acb_info;1831 uint32 acct_flags, user_rid;1832 uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;1833 uint32_t acb_info; 1834 uint32_t acct_flags, user_rid; 1835 uint32_t access_mask = MAXIMUM_ALLOWED_ACCESS; 1833 1836 uint32_t access_granted = 0; 1834 1837 struct dcerpc_binding_handle *b = cli->binding_handle; … … 1917 1920 NTSTATUS status, result; 1918 1921 struct lsa_String grp_name; 1919 uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;1922 uint32_t access_mask = MAXIMUM_ALLOWED_ACCESS; 1920 1923 uint32_t rid = 0; 1921 1924 struct dcerpc_binding_handle *b = cli->binding_handle; … … 1994 1997 NTSTATUS status, result; 1995 1998 struct lsa_String alias_name; 1996 uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;1999 uint32_t access_mask = MAXIMUM_ALLOWED_ACCESS; 1997 2000 uint32_t rid = 0; 1998 2001 struct dcerpc_binding_handle *b = cli->binding_handle; … … 2072 2075 NTSTATUS status, result; 2073 2076 struct policy_handle connect_pol, domain_pol; 2074 uint32 num_names;2077 uint32_t num_names; 2075 2078 struct samr_Ids rids, name_types; 2076 2079 int i; … … 2107 2110 num_names = argc - 2; 2108 2111 2109 if ((names = TALLOC_ARRAY(mem_ctx, struct lsa_String, num_names)) == NULL) {2112 if ((names = talloc_array(mem_ctx, struct lsa_String, num_names)) == NULL) { 2110 2113 dcerpc_samr_Close(b, mem_ctx, &domain_pol, &result); 2111 2114 dcerpc_samr_Close(b, mem_ctx, &connect_pol, &result); … … 2195 2198 num_rids = argc - 2; 2196 2199 2197 if ((rids = TALLOC_ARRAY(mem_ctx, uint32, num_rids)) == NULL) {2200 if ((rids = talloc_array(mem_ctx, uint32_t, num_rids)) == NULL) { 2198 2201 dcerpc_samr_Close(b, mem_ctx, &domain_pol, &result); 2199 2202 dcerpc_samr_Close(b, mem_ctx, &connect_pol, &result); … … 2249 2252 NTSTATUS status, result; 2250 2253 struct policy_handle connect_pol, domain_pol, group_pol; 2251 uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;2254 uint32_t access_mask = MAXIMUM_ALLOWED_ACCESS; 2252 2255 struct dcerpc_binding_handle *b = cli->binding_handle; 2253 2256 … … 2360 2363 NTSTATUS status, result; 2361 2364 struct policy_handle connect_pol, domain_pol, user_pol; 2362 uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;2365 uint32_t access_mask = MAXIMUM_ALLOWED_ACCESS; 2363 2366 struct dcerpc_binding_handle *b = cli->binding_handle; 2364 2367 … … 2472 2475 struct policy_handle connect_pol, domain_pol, user_pol, *pol; 2473 2476 NTSTATUS status, result; 2474 uint32 sec_info = SECINFO_DACL;2475 uint32 user_rid = 0;2477 uint32_t sec_info = SECINFO_DACL; 2478 uint32_t user_rid = 0; 2476 2479 TALLOC_CTX *ctx = NULL; 2477 2480 struct sec_desc_buf *sec_desc_buf=NULL; … … 2687 2690 struct policy_handle connect_pol, domain_pol; 2688 2691 NTSTATUS status, result; 2689 uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;2692 uint32_t access_mask = MAXIMUM_ALLOWED_ACCESS; 2690 2693 fstring sid_string; 2691 2694 struct lsa_String domain_name; … … 2752 2755 int argc, const char **argv) 2753 2756 { 2754 struct policy_handle connect_pol, domain_pol, user_pol; 2757 struct policy_handle connect_pol; 2758 struct policy_handle domain_pol = { 0, }; 2759 struct policy_handle user_pol = { 0, }; 2755 2760 NTSTATUS status, result; 2756 2761 const char *user, *oldpass, *newpass; 2757 uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;2762 uint32_t access_mask = MAXIMUM_ALLOWED_ACCESS; 2758 2763 struct samr_Ids rids, types; 2759 2764 struct lsa_String lsa_acct_name; … … 2866 2871 NTSTATUS status, result; 2867 2872 const char *user, *oldpass, *newpass; 2868 uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;2873 uint32_t access_mask = MAXIMUM_ALLOWED_ACCESS; 2869 2874 struct dcerpc_binding_handle *b = cli->binding_handle; 2870 2875 … … 2930 2935 NTSTATUS status, result; 2931 2936 const char *user, *oldpass, *newpass; 2932 uint32 access_mask = MAXIMUM_ALLOWED_ACCESS;2937 uint32_t access_mask = MAXIMUM_ALLOWED_ACCESS; 2933 2938 struct samr_DomInfo1 *info = NULL; 2934 2939 struct userPwdChangeFailureInformation *reject = NULL; … … 3295 3300 NTSTATUS status, result; 3296 3301 struct policy_handle connect_handle; 3297 struct policy_handle domain_handle ;3302 struct policy_handle domain_handle = { 0, }; 3298 3303 uint16_t level = 1; 3299 3304 struct lsa_String name; … … 3367 3372 { "SAMR" }, 3368 3373 3369 { "queryuser", RPC_RTYPE_NTSTATUS, cmd_samr_query_user, NULL, &ndr_table_samr .syntax_id, NULL, "Query user info", "" },3370 { "querygroup", RPC_RTYPE_NTSTATUS, cmd_samr_query_group, NULL, &ndr_table_samr .syntax_id, NULL, "Query group info", "" },3371 { "queryusergroups", RPC_RTYPE_NTSTATUS, cmd_samr_query_usergroups, NULL, &ndr_table_samr .syntax_id, NULL, "Query user groups", "" },3372 { "queryuseraliases", RPC_RTYPE_NTSTATUS, cmd_samr_query_useraliases, NULL, &ndr_table_samr .syntax_id, NULL, "Query user aliases", "" },3373 { "querygroupmem", RPC_RTYPE_NTSTATUS, cmd_samr_query_groupmem, NULL, &ndr_table_samr .syntax_id, NULL, "Query group membership", "" },3374 { "queryaliasmem", RPC_RTYPE_NTSTATUS, cmd_samr_query_aliasmem, NULL, &ndr_table_samr .syntax_id, NULL, "Query alias membership", "" },3375 { "queryaliasinfo", RPC_RTYPE_NTSTATUS, cmd_samr_query_aliasinfo, NULL, &ndr_table_samr .syntax_id, NULL, "Query alias info", "" },3376 { "deletealias", RPC_RTYPE_NTSTATUS, cmd_samr_delete_alias, NULL, &ndr_table_samr .syntax_id, NULL, "Delete an alias", "" },3377 { "querydispinfo", RPC_RTYPE_NTSTATUS, cmd_samr_query_dispinfo, NULL, &ndr_table_samr .syntax_id, NULL, "Query display info", "" },3378 { "querydispinfo2", RPC_RTYPE_NTSTATUS, cmd_samr_query_dispinfo2, NULL, &ndr_table_samr .syntax_id, NULL, "Query display info", "" },3379 { "querydispinfo3", RPC_RTYPE_NTSTATUS, cmd_samr_query_dispinfo3, NULL, &ndr_table_samr .syntax_id, NULL, "Query display info", "" },3380 { "querydominfo", RPC_RTYPE_NTSTATUS, cmd_samr_query_dominfo, NULL, &ndr_table_samr .syntax_id, NULL, "Query domain info", "" },3381 { "enumdomusers", RPC_RTYPE_NTSTATUS, cmd_samr_enum_dom_users, NULL, &ndr_table_samr .syntax_id, NULL, "Enumerate domain users", "" },3382 { "enumdomgroups", RPC_RTYPE_NTSTATUS, cmd_samr_enum_dom_groups, NULL, &ndr_table_samr .syntax_id, NULL, "Enumerate domain groups", "" },3383 { "enumalsgroups", RPC_RTYPE_NTSTATUS, cmd_samr_enum_als_groups, NULL, &ndr_table_samr .syntax_id, NULL, "Enumerate alias groups", "" },3384 { "enumdomains", RPC_RTYPE_NTSTATUS, cmd_samr_enum_domains, NULL, &ndr_table_samr .syntax_id, NULL, "Enumerate domains", "" },3385 3386 { "createdomuser", RPC_RTYPE_NTSTATUS, cmd_samr_create_dom_user, NULL, &ndr_table_samr .syntax_id, NULL, "Create domain user", "" },3387 { "createdomgroup", RPC_RTYPE_NTSTATUS, cmd_samr_create_dom_group, NULL, &ndr_table_samr .syntax_id, NULL, "Create domain group", "" },3388 { "createdomalias", RPC_RTYPE_NTSTATUS, cmd_samr_create_dom_alias, NULL, &ndr_table_samr .syntax_id, NULL, "Create domain alias", "" },3389 { "samlookupnames", RPC_RTYPE_NTSTATUS, cmd_samr_lookup_names, NULL, &ndr_table_samr .syntax_id, NULL, "Look up names", "" },3390 { "samlookuprids", RPC_RTYPE_NTSTATUS, cmd_samr_lookup_rids, NULL, &ndr_table_samr .syntax_id, NULL, "Look up names", "" },3391 { "deletedomgroup", RPC_RTYPE_NTSTATUS, cmd_samr_delete_dom_group, NULL, &ndr_table_samr .syntax_id, NULL, "Delete domain group", "" },3392 { "deletedomuser", RPC_RTYPE_NTSTATUS, cmd_samr_delete_dom_user, NULL, &ndr_table_samr .syntax_id, NULL, "Delete domain user", "" },3393 { "samquerysecobj", RPC_RTYPE_NTSTATUS, cmd_samr_query_sec_obj, NULL, &ndr_table_samr .syntax_id, NULL, "Query SAMR security object", "" },3394 { "getdompwinfo", RPC_RTYPE_NTSTATUS, cmd_samr_get_dom_pwinfo, NULL, &ndr_table_samr .syntax_id, NULL, "Retrieve domain password info", "" },3395 { "getusrdompwinfo", RPC_RTYPE_NTSTATUS, cmd_samr_get_usrdom_pwinfo, NULL, &ndr_table_samr .syntax_id, NULL, "Retrieve user domain password info", "" },3396 3397 { "lookupdomain", RPC_RTYPE_NTSTATUS, cmd_samr_lookup_domain, NULL, &ndr_table_samr .syntax_id, NULL, "Lookup Domain Name", "" },3398 { "chgpasswd", RPC_RTYPE_NTSTATUS, cmd_samr_chgpasswd, NULL, &ndr_table_samr .syntax_id, NULL, "Change user password", "" },3399 { "chgpasswd2", RPC_RTYPE_NTSTATUS, cmd_samr_chgpasswd2, NULL, &ndr_table_samr .syntax_id, NULL, "Change user password", "" },3400 { "chgpasswd3", RPC_RTYPE_NTSTATUS, cmd_samr_chgpasswd3, NULL, &ndr_table_samr .syntax_id, NULL, "Change user password", "" },3401 { "getdispinfoidx", RPC_RTYPE_NTSTATUS, cmd_samr_get_dispinfo_idx, NULL, &ndr_table_samr .syntax_id, NULL, "Get Display Information Index", "" },3402 { "setuserinfo", RPC_RTYPE_NTSTATUS, cmd_samr_setuserinfo, NULL, &ndr_table_samr .syntax_id, NULL, "Set user info", "" },3403 { "setuserinfo2", RPC_RTYPE_NTSTATUS, cmd_samr_setuserinfo2, NULL, &ndr_table_samr .syntax_id, NULL, "Set user info2", "" },3374 { "queryuser", RPC_RTYPE_NTSTATUS, cmd_samr_query_user, NULL, &ndr_table_samr, NULL, "Query user info", "" }, 3375 { "querygroup", RPC_RTYPE_NTSTATUS, cmd_samr_query_group, NULL, &ndr_table_samr, NULL, "Query group info", "" }, 3376 { "queryusergroups", RPC_RTYPE_NTSTATUS, cmd_samr_query_usergroups, NULL, &ndr_table_samr, NULL, "Query user groups", "" }, 3377 { "queryuseraliases", RPC_RTYPE_NTSTATUS, cmd_samr_query_useraliases, NULL, &ndr_table_samr, NULL, "Query user aliases", "" }, 3378 { "querygroupmem", RPC_RTYPE_NTSTATUS, cmd_samr_query_groupmem, NULL, &ndr_table_samr, NULL, "Query group membership", "" }, 3379 { "queryaliasmem", RPC_RTYPE_NTSTATUS, cmd_samr_query_aliasmem, NULL, &ndr_table_samr, NULL, "Query alias membership", "" }, 3380 { "queryaliasinfo", RPC_RTYPE_NTSTATUS, cmd_samr_query_aliasinfo, NULL, &ndr_table_samr, NULL, "Query alias info", "" }, 3381 { "deletealias", RPC_RTYPE_NTSTATUS, cmd_samr_delete_alias, NULL, &ndr_table_samr, NULL, "Delete an alias", "" }, 3382 { "querydispinfo", RPC_RTYPE_NTSTATUS, cmd_samr_query_dispinfo, NULL, &ndr_table_samr, NULL, "Query display info", "" }, 3383 { "querydispinfo2", RPC_RTYPE_NTSTATUS, cmd_samr_query_dispinfo2, NULL, &ndr_table_samr, NULL, "Query display info", "" }, 3384 { "querydispinfo3", RPC_RTYPE_NTSTATUS, cmd_samr_query_dispinfo3, NULL, &ndr_table_samr, NULL, "Query display info", "" }, 3385 { "querydominfo", RPC_RTYPE_NTSTATUS, cmd_samr_query_dominfo, NULL, &ndr_table_samr, NULL, "Query domain info", "" }, 3386 { "enumdomusers", RPC_RTYPE_NTSTATUS, cmd_samr_enum_dom_users, NULL, &ndr_table_samr, NULL, "Enumerate domain users", "" }, 3387 { "enumdomgroups", RPC_RTYPE_NTSTATUS, cmd_samr_enum_dom_groups, NULL, &ndr_table_samr, NULL, "Enumerate domain groups", "" }, 3388 { "enumalsgroups", RPC_RTYPE_NTSTATUS, cmd_samr_enum_als_groups, NULL, &ndr_table_samr, NULL, "Enumerate alias groups", "" }, 3389 { "enumdomains", RPC_RTYPE_NTSTATUS, cmd_samr_enum_domains, NULL, &ndr_table_samr, NULL, "Enumerate domains", "" }, 3390 3391 { "createdomuser", RPC_RTYPE_NTSTATUS, cmd_samr_create_dom_user, NULL, &ndr_table_samr, NULL, "Create domain user", "" }, 3392 { "createdomgroup", RPC_RTYPE_NTSTATUS, cmd_samr_create_dom_group, NULL, &ndr_table_samr, NULL, "Create domain group", "" }, 3393 { "createdomalias", RPC_RTYPE_NTSTATUS, cmd_samr_create_dom_alias, NULL, &ndr_table_samr, NULL, "Create domain alias", "" }, 3394 { "samlookupnames", RPC_RTYPE_NTSTATUS, cmd_samr_lookup_names, NULL, &ndr_table_samr, NULL, "Look up names", "" }, 3395 { "samlookuprids", RPC_RTYPE_NTSTATUS, cmd_samr_lookup_rids, NULL, &ndr_table_samr, NULL, "Look up names", "" }, 3396 { "deletedomgroup", RPC_RTYPE_NTSTATUS, cmd_samr_delete_dom_group, NULL, &ndr_table_samr, NULL, "Delete domain group", "" }, 3397 { "deletedomuser", RPC_RTYPE_NTSTATUS, cmd_samr_delete_dom_user, NULL, &ndr_table_samr, NULL, "Delete domain user", "" }, 3398 { "samquerysecobj", RPC_RTYPE_NTSTATUS, cmd_samr_query_sec_obj, NULL, &ndr_table_samr, NULL, "Query SAMR security object", "" }, 3399 { "getdompwinfo", RPC_RTYPE_NTSTATUS, cmd_samr_get_dom_pwinfo, NULL, &ndr_table_samr, NULL, "Retrieve domain password info", "" }, 3400 { "getusrdompwinfo", RPC_RTYPE_NTSTATUS, cmd_samr_get_usrdom_pwinfo, NULL, &ndr_table_samr, NULL, "Retrieve user domain password info", "" }, 3401 3402 { "lookupdomain", RPC_RTYPE_NTSTATUS, cmd_samr_lookup_domain, NULL, &ndr_table_samr, NULL, "Lookup Domain Name", "" }, 3403 { "chgpasswd", RPC_RTYPE_NTSTATUS, cmd_samr_chgpasswd, NULL, &ndr_table_samr, NULL, "Change user password", "" }, 3404 { "chgpasswd2", RPC_RTYPE_NTSTATUS, cmd_samr_chgpasswd2, NULL, &ndr_table_samr, NULL, "Change user password", "" }, 3405 { "chgpasswd3", RPC_RTYPE_NTSTATUS, cmd_samr_chgpasswd3, NULL, &ndr_table_samr, NULL, "Change user password", "" }, 3406 { "getdispinfoidx", RPC_RTYPE_NTSTATUS, cmd_samr_get_dispinfo_idx, NULL, &ndr_table_samr, NULL, "Get Display Information Index", "" }, 3407 { "setuserinfo", RPC_RTYPE_NTSTATUS, cmd_samr_setuserinfo, NULL, &ndr_table_samr, NULL, "Set user info", "" }, 3408 { "setuserinfo2", RPC_RTYPE_NTSTATUS, cmd_samr_setuserinfo2, NULL, &ndr_table_samr, NULL, "Set user info2", "" }, 3404 3409 { NULL } 3405 3410 }; -
vendor/current/source3/rpcclient/cmd_shutdown.c
r414 r988 35 35 NTSTATUS result = NT_STATUS_UNSUCCESSFUL; 36 36 fstring msg; 37 uint32 timeout = 20;37 uint32_t timeout = 20; 38 38 bool force = False; 39 39 bool reboot = False; -
vendor/current/source3/rpcclient/cmd_spoolss.c
r740 r988 26 26 #include "rpcclient.h" 27 27 #include "../librpc/gen_ndr/ndr_spoolss_c.h" 28 #include "../librpc/gen_ndr/ndr_spoolss.h" 28 29 #include "rpc_client/cli_spoolss.h" 29 30 #include "rpc_client/init_spoolss.h" 30 #include "registry/reg_objects.h"31 31 #include "nt_printing.h" 32 32 #include "../libcli/security/display_sec.h" … … 84 84 i++; 85 85 } while ( (archi_table[i].long_archi!=NULL ) && 86 StrCaseCmp(long_archi, archi_table[i].long_archi) );86 strcasecmp_m(long_archi, archi_table[i].long_archi) ); 87 87 88 88 if (archi_table[i].long_archi==NULL) { … … 765 765 ****************************************************************************/ 766 766 767 static void display_reg_value( struct regval_blob *value)767 static void display_reg_value(const char *name, enum winreg_Type type, DATA_BLOB blob) 768 768 { 769 769 const char *text = NULL; 770 DATA_BLOB blob; 771 772 switch(regval_type(value)) { 770 771 switch(type) { 773 772 case REG_DWORD: 774 printf("%s: REG_DWORD: 0x%08x\n", regval_name(value), 775 *((uint32_t *) regval_data_p(value))); 773 if (blob.length == sizeof(uint32_t)) { 774 printf("%s: REG_DWORD: 0x%08x\n", name, IVAL(blob.data,0)); 775 } else { 776 printf("%s: REG_DWORD: <invalid>\n", name); 777 } 776 778 break; 777 779 case REG_SZ: 778 blob = data_blob_const(regval_data_p(value), regval_size(value));779 780 pull_reg_sz(talloc_tos(), &blob, &text); 780 printf("%s: REG_SZ: %s\n", regval_name(value), text ? text : "");781 printf("%s: REG_SZ: %s\n", name, text ? text : ""); 781 782 break; 782 783 case REG_BINARY: { 783 char *hex = hex_encode_talloc(NULL, regval_data_p(value), regval_size(value));784 char *hex = hex_encode_talloc(NULL, blob.data, blob.length); 784 785 size_t i, len; 785 printf("%s: REG_BINARY:", regval_name(value));786 printf("%s: REG_BINARY:", name); 786 787 len = strlen(hex); 787 788 for (i=0; i<len; i++) { … … 801 802 uint32_t i; 802 803 const char **values; 803 blob = data_blob_const(regval_data_p(value), regval_size(value));804 804 805 805 if (!pull_reg_multi_sz(NULL, &blob, &values)) { … … 808 808 } 809 809 810 printf("%s: REG_MULTI_SZ: \n", regval_name(value));810 printf("%s: REG_MULTI_SZ: \n", name); 811 811 for (i=0; values[i] != NULL; i++) { 812 812 d_printf("%s\n", values[i]); … … 816 816 } 817 817 default: 818 printf("%s: unknown type %d\n", regval_name(value), regval_type(value));818 printf("%s: unknown type %d\n", name, type); 819 819 } 820 820 … … 833 833 DATA_BLOB blob = data_blob_const(data, length); 834 834 WERROR result; 835 enum ndr_err_code ndr_err; 835 836 836 837 result = pull_spoolss_PrinterData(talloc_tos(), &blob, &r, type); … … 863 864 TALLOC_FREE(hex); 864 865 putchar('\n'); 866 putchar('\n'); 867 868 if (strequal(v, "OsVersion")) { 869 struct spoolss_OSVersion os; 870 ndr_err = ndr_pull_struct_blob(&blob, talloc_tos(), &os, 871 (ndr_pull_flags_fn_t)ndr_pull_spoolss_OSVersion); 872 if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { 873 // add output here; 874 printf("OsMajor: %u\n", os.major); 875 printf("OsMinor: %u\n", os.minor); 876 printf("OsBuild: %u\n", os.build); 877 NDR_PRINT_DEBUG(spoolss_OSVersion, &os); 878 } 879 } 880 if (strequal(v, "OsVersionEx")) { 881 struct spoolss_OSVersionEx os; 882 ndr_err = ndr_pull_struct_blob(&blob, talloc_tos(), &os, 883 (ndr_pull_flags_fn_t)ndr_pull_spoolss_OSVersionEx); 884 if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { 885 printf("OsMajor: %u\n", os.major); 886 printf("OsMinor: %u\n", os.minor); 887 printf("OsBuild: %u\n", os.build); 888 printf("ServicePackMajor: %u\n", os.service_pack_major); 889 printf("ServicePackMinor: %u\n", os.service_pack_minor); 890 NDR_PRINT_DEBUG(spoolss_OSVersionEx, &os); 891 } 892 } 865 893 break; 866 894 } … … 1617 1645 will not return an empty string. See man strtok(3) 1618 1646 for details */ 1619 if (ptr && ( StrCaseCmp(ptr, "NULL") == 0)) {1647 if (ptr && (strcasecmp_m(ptr, "NULL") == 0)) { 1620 1648 ptr = NULL; 1621 1649 } … … 1631 1659 fill in the members of a spoolss_AddDriverInfo3 struct using a character 1632 1660 string in the form of 1633 <Long Printer Name>:<Driver File Name>:<Data File Name>:\1661 <Long Driver Name>:<Driver File Name>:<Data File Name>:\ 1634 1662 <Config File Name>:<Help File Name>:<Language Monitor Name>:\ 1635 1663 <Default Data Type>:<Comma Separated list of Files> … … 1640 1668 { 1641 1669 char *str, *str2; 1642 int count = 0;1670 size_t count = 0; 1643 1671 char *saveptr = NULL; 1644 1672 struct spoolss_StringArray *deps; … … 1674 1702 1675 1703 while (str != NULL) { 1676 add_string_to_array(deps, str, &file_array, &count); 1704 bool ok; 1705 ok = add_string_to_array(deps, str, &file_array, &count); 1706 if (!ok) { 1707 return false; 1708 } 1677 1709 str = strtok_r(NULL, ",", &saveptr); 1678 1710 } … … 1712 1744 { 1713 1745 printf ("Usage: %s <Environment> \\\n", argv[0]); 1714 printf ("\t<Long Printer Name>:<Driver File Name>:<Data File Name>:\\\n");1746 printf ("\t<Long Driver Name>:<Driver File Name>:<Data File Name>:\\\n"); 1715 1747 printf ("\t<Config File Name>:<Help File Name>:<Language Monitor Name>:\\\n"); 1716 1748 printf ("\t<Default Data Type>:<Comma Separated list of Files> \\\n"); … … 1794 1826 info2.printprocessor = "winprint"; 1795 1827 info2.datatype = "RAW"; 1796 info2.devmode_ptr = 0;1797 info2.secdesc_ptr = 0;1828 info2.devmode_ptr = NULL; 1829 info2.secdesc_ptr = NULL; 1798 1830 info2.attributes = PRINTER_ATTRIBUTE_SHARED; 1799 1831 info2.priority = 0; … … 1929 1961 1930 1962 /* parse the command arguments */ 1931 if (argc < 2 || argc > 4) {1932 printf ("Usage: %s <driver> [arch] [version]\n", argv[0]);1963 if (argc < 2 || argc > 5) { 1964 printf("Usage: %s <driver> [arch] [version] [flags]\n", argv[0]); 1933 1965 return WERR_OK; 1934 1966 } … … 1936 1968 if (argc >= 3) 1937 1969 arch = argv[2]; 1938 if (argc == 4) 1939 vers = atoi (argv[3]); 1940 1941 if (vers >= 0) { 1970 if (argc >= 4) { 1971 vers = atoi(argv[3]); 1942 1972 delete_flags |= DPD_DELETE_SPECIFIC_VERSION; 1943 1973 } 1974 if (argc == 5) 1975 delete_flags = atoi(argv[4]); 1944 1976 1945 1977 /* delete the driver for all architectures */ 1946 1978 for (i=0; archi_table[i].long_archi; i++) { 1947 1979 1948 if (arch && !strequal(archi_table[i].long_archi, arch))1980 if (arch && !strequal(archi_table[i].long_archi, arch)) 1949 1981 continue; 1950 1982 … … 2102 2134 NTSTATUS status; 2103 2135 const char *printername; 2104 union spoolss_AddFormInfo info;2136 struct spoolss_AddFormInfoCtr info_ctr; 2105 2137 struct spoolss_AddFormInfo1 info1; 2106 2138 struct spoolss_AddFormInfo2 info2; … … 2143 2175 info1.area.bottom = 30; 2144 2176 2145 info.info1 = &info1; 2177 info_ctr.level = 1; 2178 info_ctr.info.info1 = &info1; 2146 2179 2147 2180 break; … … 2162 2195 info2.lang_id = 0; 2163 2196 2164 info.info2 = &info2; 2197 info_ctr.level = 2; 2198 info_ctr.info.info2 = &info2; 2165 2199 2166 2200 break; … … 2172 2206 /* Add the form */ 2173 2207 2174 2175 2208 status = dcerpc_spoolss_AddForm(b, mem_ctx, 2176 2209 &handle, 2177 level, 2178 info, 2210 &info_ctr, 2179 2211 &werror); 2180 2212 if (!NT_STATUS_IS_OK(status)) { … … 2201 2233 NTSTATUS status; 2202 2234 const char *printername; 2203 union spoolss_AddFormInfo info;2235 struct spoolss_AddFormInfoCtr info_ctr; 2204 2236 struct spoolss_AddFormInfo1 info1; 2205 2237 struct dcerpc_binding_handle *b = cli->binding_handle; … … 2234 2266 info1.form_name = argv[2]; 2235 2267 2236 info.info1 = &info1; 2268 info_ctr.info.info1 = &info1; 2269 info_ctr.level = 1; 2237 2270 2238 2271 /* Set the form */ … … 2241 2274 &handle, 2242 2275 argv[2], 2243 1, 2244 info, 2276 &info_ctr, 2245 2277 &werror); 2246 2278 if (!NT_STATUS_IS_OK(status)) { … … 2536 2568 NTSTATUS status; 2537 2569 const char *printername; 2538 struct policy_handle pol ;2570 struct policy_handle pol = { 0, }; 2539 2571 union spoolss_PrinterInfo info; 2540 2572 enum winreg_Type type; … … 2613 2645 break; 2614 2646 case REG_MULTI_SZ: { 2615 int i, num_strings; 2647 int i; 2648 size_t num_strings; 2616 2649 const char **strings = NULL; 2650 2651 num_strings = 0; 2617 2652 2618 2653 for (i=4; i<argc; i++) { … … 3044 3079 r.in.enum_index++; 3045 3080 3046 { 3047 struct regval_blob *v; 3048 3049 v = regval_compose(talloc_tos(), 3050 r.out.value_name, 3051 *r.out.type, 3052 r.out.data, 3053 r.in.data_offered); 3054 if (v == NULL) { 3055 result = WERR_NOMEM; 3056 goto done; 3057 } 3058 3059 display_reg_value(v); 3060 talloc_free(v); 3061 } 3081 display_reg_value(r.out.value_name, *r.out.type, 3082 data_blob_const(r.out.data, r.in.data_offered)); 3062 3083 3063 3084 } while (W_ERROR_IS_OK(r.out.result)); … … 3210 3231 const char *printername; 3211 3232 const char *clientname; 3212 struct policy_handle hnd ;3233 struct policy_handle hnd = { 0, }; 3213 3234 WERROR result; 3214 3235 NTSTATUS status; … … 3264 3285 option.types[1].fields[0].field = JOB_NOTIFY_FIELD_PRINTER_NAME; 3265 3286 3266 clientname = talloc_asprintf(mem_ctx, "\\\\%s", global_myname());3287 clientname = talloc_asprintf(mem_ctx, "\\\\%s", lp_netbios_name()); 3267 3288 if (!clientname) { 3268 3289 result = WERR_NOMEM; … … 3430 3451 /* first get the connection to the remote server */ 3431 3452 3432 nt_status = cli_full_connection(&cli_server2, global_myname(), argv[2],3453 nt_status = cli_full_connection(&cli_server2, lp_netbios_name(), argv[2], 3433 3454 NULL, 0, 3434 3455 "IPC$", "IPC", … … 3442 3463 return WERR_GENERAL_FAILURE; 3443 3464 3444 nt_status = cli_rpc_pipe_open_noauth(cli_server2, &ndr_table_spoolss .syntax_id,3465 nt_status = cli_rpc_pipe_open_noauth(cli_server2, &ndr_table_spoolss, 3445 3466 &cli2); 3446 3467 if (!NT_STATUS_IS_OK(nt_status)) { … … 3722 3743 } 3723 3744 3745 static WERROR cmd_spoolss_play_gdi_script_on_printer_ic(struct rpc_pipe_client *cli, 3746 TALLOC_CTX *mem_ctx, int argc, 3747 const char **argv) 3748 { 3749 WERROR result; 3750 NTSTATUS status; 3751 struct policy_handle handle, gdi_handle; 3752 const char *printername; 3753 struct spoolss_DevmodeContainer devmode_ctr; 3754 struct dcerpc_binding_handle *b = cli->binding_handle; 3755 DATA_BLOB in,out; 3756 uint32_t count = 0; 3757 3758 RPCCLIENT_PRINTERNAME(printername, cli, argv[1]); 3759 3760 result = rpccli_spoolss_openprinter_ex(cli, mem_ctx, 3761 printername, 3762 SEC_FLAG_MAXIMUM_ALLOWED, 3763 &handle); 3764 if (!W_ERROR_IS_OK(result)) { 3765 return result; 3766 } 3767 3768 ZERO_STRUCT(devmode_ctr); 3769 3770 status = dcerpc_spoolss_CreatePrinterIC(b, mem_ctx, 3771 &handle, 3772 &gdi_handle, 3773 &devmode_ctr, 3774 &result); 3775 if (!NT_STATUS_IS_OK(status)) { 3776 result = ntstatus_to_werror(status); 3777 goto done; 3778 } 3779 if (!W_ERROR_IS_OK(result)) { 3780 goto done; 3781 } 3782 3783 in = data_blob_string_const(""); 3784 out = data_blob_talloc_zero(mem_ctx, 4); 3785 3786 status = dcerpc_spoolss_PlayGDIScriptOnPrinterIC(b, mem_ctx, 3787 &gdi_handle, 3788 in.data, 3789 in.length, 3790 out.data, 3791 out.length, 3792 0, /* ul */ 3793 &result); 3794 if (!NT_STATUS_IS_OK(status)) { 3795 result = ntstatus_to_werror(status); 3796 goto done; 3797 } 3798 if (!W_ERROR_IS_OK(result)) { 3799 goto done; 3800 } 3801 3802 count = IVAL(out.data, 0); 3803 3804 out = data_blob_talloc_zero(mem_ctx, 3805 count * sizeof(struct UNIVERSAL_FONT_ID) + 4); 3806 3807 status = dcerpc_spoolss_PlayGDIScriptOnPrinterIC(b, mem_ctx, 3808 &gdi_handle, 3809 in.data, 3810 in.length, 3811 out.data, 3812 out.length, 3813 0, /* ul */ 3814 &result); 3815 if (!NT_STATUS_IS_OK(status)) { 3816 result = ntstatus_to_werror(status); 3817 goto done; 3818 } 3819 if (!W_ERROR_IS_OK(result)) { 3820 goto done; 3821 } 3822 3823 { 3824 enum ndr_err_code ndr_err; 3825 struct UNIVERSAL_FONT_ID_ctr r; 3826 3827 ndr_err = ndr_pull_struct_blob(&out, mem_ctx, &r, 3828 (ndr_pull_flags_fn_t)ndr_pull_UNIVERSAL_FONT_ID_ctr); 3829 if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { 3830 NDR_PRINT_DEBUG(UNIVERSAL_FONT_ID_ctr, &r); 3831 } 3832 } 3833 3834 done: 3835 if (is_valid_policy_hnd(&gdi_handle)) { 3836 WERROR _result; 3837 dcerpc_spoolss_DeletePrinterIC(b, mem_ctx, &gdi_handle, &_result); 3838 } 3839 if (is_valid_policy_hnd(&handle)) { 3840 WERROR _result; 3841 dcerpc_spoolss_ClosePrinter(b, mem_ctx, &handle, &_result); 3842 } 3843 3844 return result; 3845 } 3846 3724 3847 /* List of commands exported by this module */ 3725 3848 struct cmd_set spoolss_commands[] = { … … 3727 3850 { "SPOOLSS" }, 3728 3851 3729 { "adddriver", RPC_RTYPE_WERROR, NULL, cmd_spoolss_addprinterdriver, &ndr_table_spoolss.syntax_id, NULL, "Add a print driver", "" }, 3730 { "addprinter", RPC_RTYPE_WERROR, NULL, cmd_spoolss_addprinterex, &ndr_table_spoolss.syntax_id, NULL, "Add a printer", "" }, 3731 { "deldriver", RPC_RTYPE_WERROR, NULL, cmd_spoolss_deletedriver, &ndr_table_spoolss.syntax_id, NULL, "Delete a printer driver", "" }, 3732 { "deldriverex", RPC_RTYPE_WERROR, NULL, cmd_spoolss_deletedriverex, &ndr_table_spoolss.syntax_id, NULL, "Delete a printer driver with files", "" }, 3733 { "enumdata", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_data, &ndr_table_spoolss.syntax_id, NULL, "Enumerate printer data", "" }, 3734 { "enumdataex", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_data_ex, &ndr_table_spoolss.syntax_id, NULL, "Enumerate printer data for a key", "" }, 3735 { "enumkey", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_printerkey, &ndr_table_spoolss.syntax_id, NULL, "Enumerate printer keys", "" }, 3736 { "enumjobs", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_jobs, &ndr_table_spoolss.syntax_id, NULL, "Enumerate print jobs", "" }, 3737 { "getjob", RPC_RTYPE_WERROR, NULL, cmd_spoolss_get_job, &ndr_table_spoolss.syntax_id, NULL, "Get print job", "" }, 3738 { "setjob", RPC_RTYPE_WERROR, NULL, cmd_spoolss_set_job, &ndr_table_spoolss.syntax_id, NULL, "Set print job", "" }, 3739 { "enumports", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_ports, &ndr_table_spoolss.syntax_id, NULL, "Enumerate printer ports", "" }, 3740 { "enumdrivers", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_drivers, &ndr_table_spoolss.syntax_id, NULL, "Enumerate installed printer drivers", "" }, 3741 { "enumprinters", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_printers, &ndr_table_spoolss.syntax_id, NULL, "Enumerate printers", "" }, 3742 { "getdata", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getprinterdata, &ndr_table_spoolss.syntax_id, NULL, "Get print driver data", "" }, 3743 { "getdataex", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getprinterdataex, &ndr_table_spoolss.syntax_id, NULL, "Get printer driver data with keyname", ""}, 3744 { "getdriver", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getdriver, &ndr_table_spoolss.syntax_id, NULL, "Get print driver information", "" }, 3745 { "getdriverdir", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getdriverdir, &ndr_table_spoolss.syntax_id, NULL, "Get print driver upload directory", "" }, 3746 { "getprinter", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getprinter, &ndr_table_spoolss.syntax_id, NULL, "Get printer info", "" }, 3747 { "openprinter", RPC_RTYPE_WERROR, NULL, cmd_spoolss_open_printer, &ndr_table_spoolss.syntax_id, NULL, "Open printer handle", "" }, 3748 { "openprinter_ex", RPC_RTYPE_WERROR, NULL, cmd_spoolss_open_printer_ex, &ndr_table_spoolss.syntax_id, NULL, "Open printer handle", "" }, 3749 { "setdriver", RPC_RTYPE_WERROR, NULL, cmd_spoolss_setdriver, &ndr_table_spoolss.syntax_id, NULL, "Set printer driver", "" }, 3750 { "getprintprocdir", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getprintprocdir, &ndr_table_spoolss.syntax_id, NULL, "Get print processor directory", "" }, 3751 { "addform", RPC_RTYPE_WERROR, NULL, cmd_spoolss_addform, &ndr_table_spoolss.syntax_id, NULL, "Add form", "" }, 3752 { "setform", RPC_RTYPE_WERROR, NULL, cmd_spoolss_setform, &ndr_table_spoolss.syntax_id, NULL, "Set form", "" }, 3753 { "getform", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getform, &ndr_table_spoolss.syntax_id, NULL, "Get form", "" }, 3754 { "deleteform", RPC_RTYPE_WERROR, NULL, cmd_spoolss_deleteform, &ndr_table_spoolss.syntax_id, NULL, "Delete form", "" }, 3755 { "enumforms", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_forms, &ndr_table_spoolss.syntax_id, NULL, "Enumerate forms", "" }, 3756 { "setprinter", RPC_RTYPE_WERROR, NULL, cmd_spoolss_setprinter, &ndr_table_spoolss.syntax_id, NULL, "Set printer comment", "" }, 3757 { "setprintername", RPC_RTYPE_WERROR, NULL, cmd_spoolss_setprintername, &ndr_table_spoolss.syntax_id, NULL, "Set printername", "" }, 3758 { "setprinterdata", RPC_RTYPE_WERROR, NULL, cmd_spoolss_setprinterdata, &ndr_table_spoolss.syntax_id, NULL, "Set REG_SZ printer data", "" }, 3759 { "rffpcnex", RPC_RTYPE_WERROR, NULL, cmd_spoolss_rffpcnex, &ndr_table_spoolss.syntax_id, NULL, "Rffpcnex test", "" }, 3760 { "printercmp", RPC_RTYPE_WERROR, NULL, cmd_spoolss_printercmp, &ndr_table_spoolss.syntax_id, NULL, "Printer comparison test", "" }, 3761 { "enumprocs", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_procs, &ndr_table_spoolss.syntax_id, NULL, "Enumerate Print Processors", "" }, 3762 { "enumprocdatatypes", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_proc_data_types, &ndr_table_spoolss.syntax_id, NULL, "Enumerate Print Processor Data Types", "" }, 3763 { "enummonitors", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_monitors, &ndr_table_spoolss.syntax_id, NULL, "Enumerate Print Monitors", "" }, 3764 { "createprinteric", RPC_RTYPE_WERROR, NULL, cmd_spoolss_create_printer_ic, &ndr_table_spoolss.syntax_id, NULL, "Create Printer IC", "" }, 3852 { "adddriver", RPC_RTYPE_WERROR, NULL, cmd_spoolss_addprinterdriver, &ndr_table_spoolss, NULL, "Add a print driver", "" }, 3853 { "addprinter", RPC_RTYPE_WERROR, NULL, cmd_spoolss_addprinterex, &ndr_table_spoolss, NULL, "Add a printer", "" }, 3854 { "deldriver", RPC_RTYPE_WERROR, NULL, cmd_spoolss_deletedriver, &ndr_table_spoolss, NULL, "Delete a printer driver", "" }, 3855 { "deldriverex", RPC_RTYPE_WERROR, NULL, cmd_spoolss_deletedriverex, &ndr_table_spoolss, NULL, "Delete a printer driver with files", "" }, 3856 { "enumdata", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_data, &ndr_table_spoolss, NULL, "Enumerate printer data", "" }, 3857 { "enumdataex", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_data_ex, &ndr_table_spoolss, NULL, "Enumerate printer data for a key", "" }, 3858 { "enumkey", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_printerkey, &ndr_table_spoolss, NULL, "Enumerate printer keys", "" }, 3859 { "enumjobs", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_jobs, &ndr_table_spoolss, NULL, "Enumerate print jobs", "" }, 3860 { "getjob", RPC_RTYPE_WERROR, NULL, cmd_spoolss_get_job, &ndr_table_spoolss, NULL, "Get print job", "" }, 3861 { "setjob", RPC_RTYPE_WERROR, NULL, cmd_spoolss_set_job, &ndr_table_spoolss, NULL, "Set print job", "" }, 3862 { "enumports", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_ports, &ndr_table_spoolss, NULL, "Enumerate printer ports", "" }, 3863 { "enumdrivers", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_drivers, &ndr_table_spoolss, NULL, "Enumerate installed printer drivers", "" }, 3864 { "enumprinters", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_printers, &ndr_table_spoolss, NULL, "Enumerate printers", "" }, 3865 { "getdata", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getprinterdata, &ndr_table_spoolss, NULL, "Get print driver data", "" }, 3866 { "getdataex", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getprinterdataex, &ndr_table_spoolss, NULL, "Get printer driver data with keyname", ""}, 3867 { "getdriver", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getdriver, &ndr_table_spoolss, NULL, "Get print driver information", "" }, 3868 { "getdriverdir", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getdriverdir, &ndr_table_spoolss, NULL, "Get print driver upload directory", "" }, 3869 { "getprinter", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getprinter, &ndr_table_spoolss, NULL, "Get printer info", "" }, 3870 { "openprinter", RPC_RTYPE_WERROR, NULL, cmd_spoolss_open_printer, &ndr_table_spoolss, NULL, "Open printer handle", "" }, 3871 { "openprinter_ex", RPC_RTYPE_WERROR, NULL, cmd_spoolss_open_printer_ex, &ndr_table_spoolss, NULL, "Open printer handle", "" }, 3872 { "setdriver", RPC_RTYPE_WERROR, NULL, cmd_spoolss_setdriver, &ndr_table_spoolss, NULL, "Set printer driver", "" }, 3873 { "getprintprocdir", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getprintprocdir, &ndr_table_spoolss, NULL, "Get print processor directory", "" }, 3874 { "addform", RPC_RTYPE_WERROR, NULL, cmd_spoolss_addform, &ndr_table_spoolss, NULL, "Add form", "" }, 3875 { "setform", RPC_RTYPE_WERROR, NULL, cmd_spoolss_setform, &ndr_table_spoolss, NULL, "Set form", "" }, 3876 { "getform", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getform, &ndr_table_spoolss, NULL, "Get form", "" }, 3877 { "deleteform", RPC_RTYPE_WERROR, NULL, cmd_spoolss_deleteform, &ndr_table_spoolss, NULL, "Delete form", "" }, 3878 { "enumforms", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_forms, &ndr_table_spoolss, NULL, "Enumerate forms", "" }, 3879 { "setprinter", RPC_RTYPE_WERROR, NULL, cmd_spoolss_setprinter, &ndr_table_spoolss, NULL, "Set printer comment", "" }, 3880 { "setprintername", RPC_RTYPE_WERROR, NULL, cmd_spoolss_setprintername, &ndr_table_spoolss, NULL, "Set printername", "" }, 3881 { "setprinterdata", RPC_RTYPE_WERROR, NULL, cmd_spoolss_setprinterdata, &ndr_table_spoolss, NULL, "Set REG_SZ printer data", "" }, 3882 { "rffpcnex", RPC_RTYPE_WERROR, NULL, cmd_spoolss_rffpcnex, &ndr_table_spoolss, NULL, "Rffpcnex test", "" }, 3883 { "printercmp", RPC_RTYPE_WERROR, NULL, cmd_spoolss_printercmp, &ndr_table_spoolss, NULL, "Printer comparison test", "" }, 3884 { "enumprocs", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_procs, &ndr_table_spoolss, NULL, "Enumerate Print Processors", "" }, 3885 { "enumprocdatatypes", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_proc_data_types, &ndr_table_spoolss, NULL, "Enumerate Print Processor Data Types", "" }, 3886 { "enummonitors", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_monitors, &ndr_table_spoolss, NULL, "Enumerate Print Monitors", "" }, 3887 { "createprinteric", RPC_RTYPE_WERROR, NULL, cmd_spoolss_create_printer_ic, &ndr_table_spoolss, NULL, "Create Printer IC", "" }, 3888 { "playgdiscriptonprinteric", RPC_RTYPE_WERROR, NULL, cmd_spoolss_play_gdi_script_on_printer_ic, &ndr_table_spoolss, NULL, "Create Printer IC", "" }, 3765 3889 3766 3890 { NULL } -
vendor/current/source3/rpcclient/cmd_srvsvc.c
r740 r988 29 29 /* Display server query info */ 30 30 31 static char *get_server_type_str(uint32 type)31 static char *get_server_type_str(uint32_t type) 32 32 { 33 33 static fstring typestr; … … 134 134 } 135 135 136 static void display_server(const char *sname, uint32 type, const char *comment)136 static void display_server(const char *sname, uint32_t type, const char *comment) 137 137 { 138 138 printf("\t%-15.15s%-20s %s\n", sname, get_server_type_str(type), … … 172 172 int argc, const char **argv) 173 173 { 174 uint32 info_level = 101;174 uint32_t info_level = 101; 175 175 union srvsvc_NetSrvInfo info; 176 176 WERROR result; … … 254 254 } 255 255 256 static void display_share_info_1005(struct srvsvc_NetShareInfo1005 *r) 257 { 258 printf("flags: 0x%x\n", r->dfs_flags); 259 printf("csc caching: %u\n", 260 (r->dfs_flags & SHARE_1005_CSC_POLICY_MASK) >> 261 SHARE_1005_CSC_POLICY_SHIFT); 262 } 263 256 264 static WERROR cmd_srvsvc_net_share_enum_int(struct rpc_pipe_client *cli, 257 265 TALLOC_CTX *mem_ctx, … … 259 267 uint32_t opcode) 260 268 { 261 uint32 info_level = 2;269 uint32_t info_level = 2; 262 270 struct srvsvc_NetShareInfoCtr info_ctr; 263 271 struct srvsvc_NetShareCtr0 ctr0; … … 274 282 NTSTATUS status; 275 283 uint32_t totalentries = 0; 284 uint32_t count = 0; 276 285 uint32_t resume_handle = 0; 277 286 uint32_t *resume_handle_p = NULL; 278 uint32 preferred_len = 0xffffffff, i;287 uint32_t preferred_len = 0xffffffff, i; 279 288 struct dcerpc_binding_handle *b = cli->binding_handle; 280 289 … … 375 384 switch (info_level) { 376 385 case 1: 377 for (i = 0; i < totalentries; i++) 386 count = info_ctr.ctr.ctr1->count; 387 for (i = 0; i < count; i++) 378 388 display_share_info_1(&info_ctr.ctr.ctr1->array[i]); 379 389 break; 380 390 case 2: 381 for (i = 0; i < totalentries; i++) 391 count = info_ctr.ctr.ctr2->count; 392 for (i = 0; i < count; i++) 382 393 display_share_info_2(&info_ctr.ctr.ctr2->array[i]); 383 394 break; 384 395 case 502: 385 for (i = 0; i < totalentries; i++) 396 count = info_ctr.ctr.ctr502->count; 397 for (i = 0; i < count; i++) 386 398 display_share_info_502(&info_ctr.ctr.ctr502->array[i]); 387 399 break; … … 417 429 int argc, const char **argv) 418 430 { 419 uint32 info_level = 502;431 uint32_t info_level = 502; 420 432 union srvsvc_NetShareInfo info; 421 433 WERROR result; … … 424 436 425 437 if (argc < 2 || argc > 3) { 426 printf("Usage: %s [sharename] [infolevel]\n", argv[0]); 438 printf("Usage: %s sharename [infolevel 1|2|502|1005]\n", 439 argv[0]); 427 440 return WERR_OK; 428 441 } … … 458 471 display_share_info_502(info.info502); 459 472 break; 473 case 1005: 474 display_share_info_1005(info.info1005); 475 break; 460 476 default: 461 477 printf("unsupported info level %d\n", info_level); … … 471 487 int argc, const char **argv) 472 488 { 473 uint32 info_level = 502;489 uint32_t info_level = 502; 474 490 union srvsvc_NetShareInfo info_get; 475 491 WERROR result; … … 539 555 } 540 556 557 static WERROR cmd_srvsvc_net_share_set_dfs_flags(struct rpc_pipe_client *cli, 558 TALLOC_CTX *mem_ctx, 559 int argc, const char **argv) 560 { 561 struct srvsvc_NetShareInfo1005 info1005 = { 0 }; 562 union srvsvc_NetShareInfo info = { .info1005 = &info1005 }; 563 WERROR result; 564 NTSTATUS status; 565 uint32_t parm_err = 0; 566 struct dcerpc_binding_handle *b = cli->binding_handle; 567 568 if (argc > 3) { 569 printf("Usage: %s [sharename] [dfsflags]\n", argv[0]); 570 return WERR_OK; 571 } 572 573 if (argc > 2) { 574 info.info1005->dfs_flags = strtol(argv[2], NULL, 0); 575 } 576 577 /* set share info */ 578 status = dcerpc_srvsvc_NetShareSetInfo(b, mem_ctx, 579 cli->desthost, 580 argv[1], 581 1005, 582 &info, 583 &parm_err, 584 &result); 585 586 if (!NT_STATUS_IS_OK(status)) { 587 return ntstatus_to_werror(status); 588 } 589 if (!W_ERROR_IS_OK(result)) { 590 return result; 591 } 592 593 /* re-retrieve share info and display */ 594 status = dcerpc_srvsvc_NetShareGetInfo(b, mem_ctx, 595 cli->desthost, 596 argv[1], 597 1005, 598 &info, 599 &result); 600 if (!NT_STATUS_IS_OK(status)) { 601 return ntstatus_to_werror(status); 602 } 603 if (!W_ERROR_IS_OK(result)) { 604 return result; 605 } 606 607 display_share_info_1005(info.info1005); 608 609 return result; 610 } 611 541 612 static WERROR cmd_srvsvc_net_remote_tod(struct rpc_pipe_client *cli, 542 613 TALLOC_CTX *mem_ctx, … … 573 644 int argc, const char **argv) 574 645 { 575 uint32 info_level = 3;646 uint32_t info_level = 3; 576 647 struct srvsvc_NetFileInfoCtr info_ctr; 577 648 struct srvsvc_NetFileCtr3 ctr3; 578 649 WERROR result; 579 650 NTSTATUS status; 580 uint32 preferred_len = 0xffff;651 uint32_t preferred_len = 0xffff; 581 652 uint32_t total_entries = 0; 582 653 uint32_t resume_handle = 0; … … 938 1009 } 939 1010 1011 static WERROR cmd_srvsvc_net_share_add(struct rpc_pipe_client *cli, 1012 TALLOC_CTX *mem_ctx, 1013 int argc, const char **argv) 1014 { 1015 struct srvsvc_NetShareInfo502 info502 = { 0 }; 1016 union srvsvc_NetShareInfo info = { .info502 = &info502 }; 1017 WERROR result; 1018 NTSTATUS status; 1019 uint32_t max_users = -1, parm_error; 1020 struct sec_desc_buf sd_buf = { 0 }; 1021 const char *path, *share_name, *comment = NULL; 1022 struct dcerpc_binding_handle *b = cli->binding_handle; 1023 1024 if (argc < 3 || argc > 5) { 1025 printf("Usage: %s path share_name [max_users] [comment]\n", 1026 argv[0]); 1027 return WERR_OK; 1028 } 1029 1030 path = argv[1]; 1031 share_name = argv[2]; 1032 1033 if (argc >= 4) { 1034 max_users = atoi(argv[3]); 1035 } 1036 1037 if (argc >= 5) { 1038 comment = argv[4]; 1039 } 1040 1041 info.info502->name = share_name; 1042 info.info502->type = STYPE_DISKTREE; 1043 info.info502->comment = comment; 1044 info.info502->max_users = max_users; 1045 info.info502->path = path; 1046 info.info502->sd_buf = sd_buf; 1047 1048 status = dcerpc_srvsvc_NetShareAdd(b, mem_ctx, cli->desthost, 1049 502, &info, &parm_error, &result); 1050 if (!NT_STATUS_IS_OK(status)) { 1051 result = ntstatus_to_werror(status); 1052 } 1053 1054 return result; 1055 } 1056 1057 static WERROR cmd_srvsvc_net_share_del(struct rpc_pipe_client *cli, 1058 TALLOC_CTX *mem_ctx, 1059 int argc, const char **argv) 1060 { 1061 const char *share_name; 1062 WERROR result; 1063 NTSTATUS status; 1064 struct dcerpc_binding_handle *b = cli->binding_handle; 1065 1066 if (argc < 2) { 1067 printf("Usage: %s share_name\n", argv[0]); 1068 return WERR_OK; 1069 } 1070 1071 share_name = argv[1]; 1072 1073 status = dcerpc_srvsvc_NetShareDel(b, mem_ctx, cli->desthost, 1074 share_name, 0, &result); 1075 1076 if (!NT_STATUS_IS_OK(status)) { 1077 result = ntstatus_to_werror(status); 1078 } 1079 1080 return result; 1081 } 1082 940 1083 941 1084 /* List of commands exported by this module */ … … 945 1088 { "SRVSVC" }, 946 1089 947 { "srvinfo", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_srv_query_info, &ndr_table_srvsvc.syntax_id, NULL, "Server query info", "" }, 948 { "netshareenum",RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_share_enum, &ndr_table_srvsvc.syntax_id, NULL, "Enumerate shares", "" }, 949 { "netshareenumall",RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_share_enum_all, &ndr_table_srvsvc.syntax_id, NULL, "Enumerate all shares", "" }, 950 { "netsharegetinfo",RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_share_get_info, &ndr_table_srvsvc.syntax_id, NULL, "Get Share Info", "" }, 951 { "netsharesetinfo",RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_share_set_info, &ndr_table_srvsvc.syntax_id, NULL, "Set Share Info", "" }, 952 { "netfileenum", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_file_enum, &ndr_table_srvsvc.syntax_id, NULL, "Enumerate open files", "" }, 953 { "netremotetod",RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_remote_tod, &ndr_table_srvsvc.syntax_id, NULL, "Fetch remote time of day", "" }, 954 { "netnamevalidate", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_name_validate, &ndr_table_srvsvc.syntax_id, NULL, "Validate sharename", "" }, 955 { "netfilegetsec", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_file_get_sec, &ndr_table_srvsvc.syntax_id, NULL, "Get File security", "" }, 956 { "netsessdel", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_sess_del, &ndr_table_srvsvc.syntax_id, NULL, "Delete Session", "" }, 957 { "netsessenum", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_sess_enum, &ndr_table_srvsvc.syntax_id, NULL, "Enumerate Sessions", "" }, 958 { "netdiskenum", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_disk_enum, &ndr_table_srvsvc.syntax_id, NULL, "Enumerate Disks", "" }, 959 { "netconnenum", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_conn_enum, &ndr_table_srvsvc.syntax_id, NULL, "Enumerate Connections", "" }, 1090 { "srvinfo", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_srv_query_info, &ndr_table_srvsvc, NULL, "Server query info", "" }, 1091 { "netshareenum",RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_share_enum, &ndr_table_srvsvc, NULL, "Enumerate shares", "" }, 1092 { "netshareenumall",RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_share_enum_all, &ndr_table_srvsvc, NULL, "Enumerate all shares", "" }, 1093 { "netsharegetinfo",RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_share_get_info, &ndr_table_srvsvc, NULL, "Get Share Info", "" }, 1094 { "netsharesetinfo",RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_share_set_info, &ndr_table_srvsvc, NULL, "Set Share Info", "" }, 1095 { "netsharesetdfsflags",RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_share_set_dfs_flags, &ndr_table_srvsvc, NULL, "Set DFS flags", "" }, 1096 { "netfileenum", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_file_enum, &ndr_table_srvsvc, NULL, "Enumerate open files", "" }, 1097 { "netremotetod",RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_remote_tod, &ndr_table_srvsvc, NULL, "Fetch remote time of day", "" }, 1098 { "netnamevalidate", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_name_validate, &ndr_table_srvsvc, NULL, "Validate sharename", "" }, 1099 { "netfilegetsec", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_file_get_sec, &ndr_table_srvsvc, NULL, "Get File security", "" }, 1100 { "netsessdel", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_sess_del, &ndr_table_srvsvc, NULL, "Delete Session", "" }, 1101 { "netsessenum", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_sess_enum, &ndr_table_srvsvc, NULL, "Enumerate Sessions", "" }, 1102 { "netdiskenum", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_disk_enum, &ndr_table_srvsvc, NULL, "Enumerate Disks", "" }, 1103 { "netconnenum", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_conn_enum, &ndr_table_srvsvc, NULL, "Enumerate Connections", "" }, 1104 { "netshareadd", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_share_add, &ndr_table_srvsvc, NULL, "Add share", "" }, 1105 { "netsharedel", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_share_del, &ndr_table_srvsvc, NULL, "Delete share", "" }, 960 1106 961 1107 { NULL } -
vendor/current/source3/rpcclient/cmd_test.c
r740 r988 36 36 d_printf("testme\n"); 37 37 38 status = cli_rpc_pipe_open_noauth(rpc _pipe_np_smb_conn(cli),39 &ndr_table_lsarpc .syntax_id,38 status = cli_rpc_pipe_open_noauth(rpcclient_cli_state, 39 &ndr_table_lsarpc, 40 40 &lsa_pipe); 41 41 if (!NT_STATUS_IS_OK(status)) { … … 43 43 } 44 44 45 status = cli_rpc_pipe_open_noauth(rpc _pipe_np_smb_conn(cli),46 &ndr_table_samr .syntax_id,45 status = cli_rpc_pipe_open_noauth(rpcclient_cli_state, 46 &ndr_table_samr, 47 47 &samr_pipe); 48 48 if (!NT_STATUS_IS_OK(status)) { -
vendor/current/source3/rpcclient/cmd_winreg.c
r740 r988 320 320 321 321 { "WINREG" }, 322 { "winreg_enumkey", RPC_RTYPE_WERROR, NULL, cmd_winreg_enumkeys, &ndr_table_winreg .syntax_id, NULL, "Enumerate Keys", "" },323 { "querymultiplevalues", RPC_RTYPE_WERROR, NULL, cmd_winreg_querymultiplevalues, &ndr_table_winreg .syntax_id, NULL, "Query multiple values", "" },324 { "querymultiplevalues2", RPC_RTYPE_WERROR, NULL, cmd_winreg_querymultiplevalues2, &ndr_table_winreg .syntax_id, NULL, "Query multiple values", "" },322 { "winreg_enumkey", RPC_RTYPE_WERROR, NULL, cmd_winreg_enumkeys, &ndr_table_winreg, NULL, "Enumerate Keys", "" }, 323 { "querymultiplevalues", RPC_RTYPE_WERROR, NULL, cmd_winreg_querymultiplevalues, &ndr_table_winreg, NULL, "Query multiple values", "" }, 324 { "querymultiplevalues2", RPC_RTYPE_WERROR, NULL, cmd_winreg_querymultiplevalues2, &ndr_table_winreg, NULL, "Query multiple values", "" }, 325 325 { NULL } 326 326 }; -
vendor/current/source3/rpcclient/cmd_wkssvc.c
r740 r988 217 217 218 218 { "WKSSVC" }, 219 { "wkssvc_wkstagetinfo", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_wkstagetinfo, &ndr_table_wkssvc .syntax_id, NULL, "Query WKSSVC Workstation Information", "" },220 { "wkssvc_getjoininformation", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_getjoininformation, &ndr_table_wkssvc .syntax_id, NULL, "Query WKSSVC Join Information", "" },221 { "wkssvc_messagebuffersend", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_messagebuffersend, &ndr_table_wkssvc .syntax_id, NULL, "Send WKSSVC message", "" },222 { "wkssvc_enumeratecomputernames", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_enumeratecomputernames, &ndr_table_wkssvc .syntax_id, NULL, "Enumerate WKSSVC computer names", "" },219 { "wkssvc_wkstagetinfo", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_wkstagetinfo, &ndr_table_wkssvc, NULL, "Query WKSSVC Workstation Information", "" }, 220 { "wkssvc_getjoininformation", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_getjoininformation, &ndr_table_wkssvc, NULL, "Query WKSSVC Join Information", "" }, 221 { "wkssvc_messagebuffersend", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_messagebuffersend, &ndr_table_wkssvc, NULL, "Send WKSSVC message", "" }, 222 { "wkssvc_enumeratecomputernames", RPC_RTYPE_WERROR, NULL, cmd_wkssvc_enumeratecomputernames, &ndr_table_wkssvc, NULL, "Enumerate WKSSVC computer names", "" }, 223 223 { "wkssvc_enumerateusers", RPC_RTYPE_WERROR, NULL, 224 cmd_wkssvc_enumerateusers, &ndr_table_wkssvc .syntax_id, NULL,224 cmd_wkssvc_enumerateusers, &ndr_table_wkssvc, NULL, 225 225 "Enumerate WKSSVC users", "" }, 226 226 { NULL } -
vendor/current/source3/rpcclient/rpcclient.c
r919 r988 32 32 #include "passdb.h" 33 33 #include "libsmb/libsmb.h" 34 #include "auth/gensec/gensec.h" 35 #include "../libcli/smb/smbXcli_base.h" 36 #include "messages.h" 34 37 35 38 enum pipe_auth_type_spnego { … … 47 50 static enum dcerpc_transport_t default_transport = NCACN_NP; 48 51 52 struct messaging_context *rpcclient_msg_ctx; 49 53 struct user_auth_info *rpcclient_auth_info; 54 struct cli_state *rpcclient_cli_state; 55 struct netlogon_creds_cli_context *rpcclient_netlogon_creds; 50 56 51 57 /* List to hold groups of commands. … … 166 172 } 167 173 168 result = cli_rpc_pipe_open_noauth(cli, &ndr_table_lsarpc .syntax_id,174 result = cli_rpc_pipe_open_noauth(cli, &ndr_table_lsarpc, 169 175 &lsapipe); 170 176 if (!NT_STATUS_IS_OK(result)) { … … 210 216 } 211 217 212 fprintf(stderr, "could not obtain sid f or domain %s\n", cli->domain);218 fprintf(stderr, "could not obtain sid from server\n"); 213 219 214 220 if (!NT_STATUS_IS_OK(result)) { … … 241 247 tmp_set = tmp->cmd_set; 242 248 243 if (! StrCaseCmp(argv[1], tmp_set->name))249 if (!strcasecmp_m(argv[1], tmp_set->name)) 244 250 { 245 251 printf("Available commands on the %s pipe:\n\n", tmp_set->name); … … 482 488 int argc, const char **argv) 483 489 { 484 struct cmd_list *tmp;485 486 490 if (argc > 2) { 487 491 printf("Usage: %s timeout\n", argv[0]); … … 491 495 if (argc == 2) { 492 496 timeout = atoi(argv[1]); 493 494 for (tmp = cmd_list; tmp; tmp = tmp->next) {495 496 struct cmd_set *tmp_set;497 498 for (tmp_set = tmp->cmd_set; tmp_set->name; tmp_set++) {499 if (tmp_set->rpc_pipe == NULL) {500 continue;501 }502 503 rpccli_set_timeout(tmp_set->rpc_pipe, timeout);504 }505 }506 497 } 507 498 … … 619 610 extern struct cmd_set eventlog_commands[]; 620 611 extern struct cmd_set winreg_commands[]; 612 extern struct cmd_set fss_commands[]; 613 extern struct cmd_set witness_commands[]; 614 extern struct cmd_set clusapi_commands[]; 621 615 622 616 static struct cmd_set *rpcclient_command_list[] = { … … 638 632 eventlog_commands, 639 633 winreg_commands, 634 fss_commands, 635 witness_commands, 636 clusapi_commands, 640 637 NULL 641 638 }; … … 666 663 struct cmd_set *cmd_entry, 667 664 struct dcerpc_binding *binding, 668 int argc, c har **argv)665 int argc, const char **argv) 669 666 { 670 667 NTSTATUS ntresult; … … 675 672 /* Create mem_ctx */ 676 673 677 if (!(mem_ctx = talloc_ init("do_cmd"))) {674 if (!(mem_ctx = talloc_stackframe())) { 678 675 DEBUG(0, ("talloc_init() failed\n")); 679 676 return NT_STATUS_NO_MEMORY; … … 682 679 /* Open pipe */ 683 680 684 if ((cmd_entry->interface != NULL) && (cmd_entry->rpc_pipe == NULL)) { 681 if ((cmd_entry->table != NULL) && (cmd_entry->rpc_pipe == NULL)) { 682 enum credentials_use_kerberos use_kerberos = CRED_AUTO_USE_KERBEROS; 685 683 switch (pipe_default_auth_type) { 686 684 case DCERPC_AUTH_TYPE_NONE: 687 685 ntresult = cli_rpc_pipe_open_noauth_transport( 688 686 cli, default_transport, 689 cmd_entry-> interface,687 cmd_entry->table, 690 688 &cmd_entry->rpc_pipe); 691 689 break; … … 693 691 switch (pipe_default_auth_spnego_type) { 694 692 case PIPE_AUTH_TYPE_SPNEGO_NTLMSSP: 695 ntresult = cli_rpc_pipe_open_spnego_ntlmssp( 696 cli, cmd_entry->interface, 697 default_transport, 698 pipe_default_auth_level, 699 get_cmdline_auth_info_domain(auth_info), 700 get_cmdline_auth_info_username(auth_info), 701 get_cmdline_auth_info_password(auth_info), 702 &cmd_entry->rpc_pipe); 693 use_kerberos = CRED_DONT_USE_KERBEROS; 703 694 break; 704 695 case PIPE_AUTH_TYPE_SPNEGO_KRB5: 705 ntresult = cli_rpc_pipe_open_spnego_krb5( 706 cli, cmd_entry->interface, 707 default_transport, 708 pipe_default_auth_level, 709 cli->desthost, 710 NULL, NULL, 711 &cmd_entry->rpc_pipe); 696 use_kerberos = CRED_MUST_USE_KERBEROS; 712 697 break; 713 default: 714 ntresult = NT_STATUS_INTERNAL_ERROR; 698 case PIPE_AUTH_TYPE_SPNEGO_NONE: 699 use_kerberos = CRED_AUTO_USE_KERBEROS; 700 break; 715 701 } 716 break;702 /* Fall through */ 717 703 case DCERPC_AUTH_TYPE_NTLMSSP: 718 ntresult = cli_rpc_pipe_open_ntlmssp( 719 cli, cmd_entry->interface, 704 case DCERPC_AUTH_TYPE_KRB5: 705 ntresult = cli_rpc_pipe_open_generic_auth( 706 cli, cmd_entry->table, 720 707 default_transport, 708 use_kerberos, 709 pipe_default_auth_type, 721 710 pipe_default_auth_level, 711 smbXcli_conn_remote_name(cli->conn), 722 712 get_cmdline_auth_info_domain(auth_info), 723 713 get_cmdline_auth_info_username(auth_info), … … 726 716 break; 727 717 case DCERPC_AUTH_TYPE_SCHANNEL: 718 TALLOC_FREE(rpcclient_netlogon_creds); 728 719 ntresult = cli_rpc_pipe_open_schannel( 729 cli, cmd_entry->interface, 720 cli, rpcclient_msg_ctx, 721 cmd_entry->table, 730 722 default_transport, 731 pipe_default_auth_level,732 723 get_cmdline_auth_info_domain(auth_info), 733 &cmd_entry->rpc_pipe); 734 break; 735 case DCERPC_AUTH_TYPE_KRB5: 736 ntresult = cli_rpc_pipe_open_krb5( 737 cli, cmd_entry->interface, 738 default_transport, 739 pipe_default_auth_level, 740 cli->desthost, 741 NULL, NULL, 742 &cmd_entry->rpc_pipe); 724 &cmd_entry->rpc_pipe, 725 talloc_autofree_context(), 726 &rpcclient_netlogon_creds); 743 727 break; 744 728 default: 745 729 DEBUG(0, ("Could not initialise %s. Invalid " 746 730 "auth type %u\n", 747 get_pipe_name_from_syntax( 748 talloc_tos(), 749 cmd_entry->interface), 731 cmd_entry->table->name, 750 732 pipe_default_auth_type )); 733 talloc_free(mem_ctx); 751 734 return NT_STATUS_UNSUCCESSFUL; 752 735 } 753 736 if (!NT_STATUS_IS_OK(ntresult)) { 754 737 DEBUG(0, ("Could not initialise %s. Error was %s\n", 755 get_pipe_name_from_syntax( 756 talloc_tos(), cmd_entry->interface), 738 cmd_entry->table->name, 757 739 nt_errstr(ntresult) )); 740 talloc_free(mem_ctx); 758 741 return ntresult; 759 742 } 760 743 761 if (ndr_syntax_id_equal(cmd_entry->interface, 762 &ndr_table_netlogon.syntax_id)) { 763 uint32_t neg_flags = NETLOGON_NEG_AUTH2_ADS_FLAGS; 764 enum netr_SchannelType sec_channel_type; 765 uchar trust_password[16]; 766 const char *machine_account; 767 768 if (!get_trust_pw_hash(get_cmdline_auth_info_domain(auth_info), 769 trust_password, &machine_account, 770 &sec_channel_type)) 771 { 772 return NT_STATUS_CANT_ACCESS_DOMAIN_INFO; 744 if (rpcclient_netlogon_creds == NULL && cmd_entry->use_netlogon_creds) { 745 const char *dc_name = cmd_entry->rpc_pipe->desthost; 746 const char *domain = get_cmdline_auth_info_domain(auth_info); 747 struct cli_credentials *creds = NULL; 748 749 ntresult = pdb_get_trust_credentials(domain, NULL, 750 mem_ctx, &creds); 751 if (!NT_STATUS_IS_OK(ntresult)) { 752 DEBUG(0, ("Failed to fetch trust credentials for " 753 "%s to connect to %s: %s\n", 754 domain, cmd_entry->table->name, 755 nt_errstr(ntresult))); 756 TALLOC_FREE(cmd_entry->rpc_pipe); 757 talloc_free(mem_ctx); 758 return ntresult; 773 759 } 774 760 775 ntresult = rpccli_netlogon_setup_creds(cmd_entry->rpc_pipe, 776 cli->desthost, /* server name */ 777 get_cmdline_auth_info_domain(auth_info), /* domain */ 778 global_myname(), /* client name */ 779 machine_account, /* machine account name */ 780 trust_password, 781 sec_channel_type, 782 &neg_flags); 783 761 ntresult = rpccli_create_netlogon_creds_with_creds(creds, 762 dc_name, 763 rpcclient_msg_ctx, 764 talloc_autofree_context(), 765 &rpcclient_netlogon_creds); 784 766 if (!NT_STATUS_IS_OK(ntresult)) { 785 767 DEBUG(0, ("Could not initialise credentials for %s.\n", 786 get_pipe_name_from_syntax(787 talloc_tos(),788 cmd_entry->interface)));768 cmd_entry->table->name)); 769 TALLOC_FREE(cmd_entry->rpc_pipe); 770 TALLOC_FREE(mem_ctx); 789 771 return ntresult; 790 772 } 791 } 773 774 ntresult = rpccli_setup_netlogon_creds_with_creds(cli, 775 NCACN_NP, 776 rpcclient_netlogon_creds, 777 false, /* force_reauth */ 778 creds); 779 TALLOC_FREE(creds); 780 if (!NT_STATUS_IS_OK(ntresult)) { 781 DEBUG(0, ("Could not initialise credentials for %s.\n", 782 cmd_entry->table->name)); 783 TALLOC_FREE(cmd_entry->rpc_pipe); 784 TALLOC_FREE(rpcclient_netlogon_creds); 785 TALLOC_FREE(mem_ctx); 786 return ntresult; 787 } 788 } 789 } 790 791 /* Set timeout for new connections */ 792 if (cmd_entry->rpc_pipe) { 793 rpccli_set_timeout(cmd_entry->rpc_pipe, timeout); 792 794 } 793 795 … … 795 797 796 798 if ( cmd_entry->returntype == RPC_RTYPE_NTSTATUS ) { 797 ntresult = cmd_entry->ntfn(cmd_entry->rpc_pipe, mem_ctx, argc, (const char **)argv);799 ntresult = cmd_entry->ntfn(cmd_entry->rpc_pipe, mem_ctx, argc, argv); 798 800 if (!NT_STATUS_IS_OK(ntresult)) { 799 801 printf("result was %s\n", nt_errstr(ntresult)); 800 802 } 801 803 } else { 802 wresult = cmd_entry->wfn(cmd_entry->rpc_pipe, mem_ctx, argc, (const char **)argv);804 wresult = cmd_entry->wfn(cmd_entry->rpc_pipe, mem_ctx, argc, argv); 803 805 /* print out the DOS error */ 804 806 if (!W_ERROR_IS_OK(wresult)) { … … 810 812 /* Cleanup */ 811 813 812 talloc_ destroy(mem_ctx);814 talloc_free(mem_ctx); 813 815 814 816 return ntresult; … … 830 832 int ret; 831 833 int argc; 832 c har **argv = NULL;833 834 if ((ret = poptParseArgvString(cmd, &argc, (const char ***)&argv)) != 0) {834 const char **argv = NULL; 835 836 if ((ret = poptParseArgvString(cmd, &argc, &argv)) != 0) { 835 837 fprintf(stderr, "rpcclient: %s\n", poptStrerror(ret)); 836 838 return NT_STATUS_UNSUCCESSFUL; … … 884 886 int main(int argc, char *argv[]) 885 887 { 888 const char **const_argv = discard_const_p(const char *, argv); 886 889 int opt; 887 890 static char *cmdstr = NULL; … … 893 896 NTSTATUS nt_status; 894 897 static int opt_port = 0; 895 fstring new_workgroup;896 898 int result = 0; 897 899 TALLOC_CTX *frame = talloc_stackframe(); 898 900 uint32_t flags = 0; 899 901 struct dcerpc_binding *binding = NULL; 902 enum dcerpc_transport_t transport; 903 uint32_t bflags = 0; 900 904 const char *binding_string = NULL; 901 905 char *user, *domain, *q; 906 const char *host; 902 907 903 908 /* make sure the vars that get altered (4th field) are in … … 915 920 }; 916 921 917 load_case_tables();922 smb_init_locale(); 918 923 919 924 zero_sockaddr(&server_ss); … … 924 929 facilities. See lib/debug.c */ 925 930 setup_logging("rpcclient", DEBUG_STDOUT); 931 lp_set_cmdline("log level", "0"); 926 932 927 933 rpcclient_auth_info = user_auth_info_init(frame); … … 933 939 /* Parse options */ 934 940 935 pc = poptGetContext("rpcclient", argc, (const char **)argv,941 pc = poptGetContext("rpcclient", argc, const_argv, 936 942 long_options, 0); 937 943 … … 968 974 969 975 poptFreeContext(pc); 970 971 load_interfaces(); 976 popt_burn_cmdline_password(argc, argv); 972 977 973 978 if (!init_names()) { … … 976 981 } 977 982 978 /* save the workgroup...979 980 FIXME!! do we need to do this for other options as well981 (or maybe a generic way to keep lp_load() from overwriting982 everything)? */983 984 fstrcpy( new_workgroup, lp_workgroup() );985 986 983 /* Load smb.conf file */ 987 984 988 if (!lp_load (get_dyn_CONFIGFILE(),True,False,False,True))985 if (!lp_load_global(get_dyn_CONFIGFILE())) 989 986 fprintf(stderr, "Can't load %s\n", get_dyn_CONFIGFILE()); 990 987 991 if ( strlen(new_workgroup) != 0 ) 992 set_global_myworkgroup( new_workgroup ); 988 /* We must load interfaces after we load the smb.conf */ 989 load_interfaces(); 990 991 rpcclient_msg_ctx = messaging_init(talloc_autofree_context(), 992 samba_tevent_context_init(talloc_autofree_context())); 993 993 994 994 /* … … 1028 1028 } 1029 1029 1030 if (binding->transport == NCA_UNKNOWN) { 1031 binding->transport = NCACN_NP; 1032 } 1033 1034 if (binding->flags & DCERPC_CONNECT) { 1030 transport = dcerpc_binding_get_transport(binding); 1031 1032 if (transport == NCA_UNKNOWN) { 1033 nt_status = dcerpc_binding_set_transport(binding, NCACN_NP); 1034 if (!NT_STATUS_IS_OK(nt_status)) { 1035 result = -1; 1036 goto done; 1037 } 1038 } 1039 1040 host = dcerpc_binding_get_string_option(binding, "host"); 1041 1042 bflags = dcerpc_binding_get_flags(binding); 1043 if (bflags & DCERPC_CONNECT) { 1035 1044 pipe_default_auth_level = DCERPC_AUTH_LEVEL_CONNECT; 1036 1045 pipe_default_auth_type = DCERPC_AUTH_TYPE_NTLMSSP; 1037 1046 } 1038 if (b inding->flags & DCERPC_SIGN) {1047 if (bflags & DCERPC_SIGN) { 1039 1048 pipe_default_auth_level = DCERPC_AUTH_LEVEL_INTEGRITY; 1040 1049 pipe_default_auth_type = DCERPC_AUTH_TYPE_NTLMSSP; 1041 1050 } 1042 if (b inding->flags & DCERPC_SEAL) {1051 if (bflags & DCERPC_SEAL) { 1043 1052 pipe_default_auth_level = DCERPC_AUTH_LEVEL_PRIVACY; 1044 1053 pipe_default_auth_type = DCERPC_AUTH_TYPE_NTLMSSP; 1045 1054 } 1046 if (b inding->flags & DCERPC_AUTH_SPNEGO) {1055 if (bflags & DCERPC_AUTH_SPNEGO) { 1047 1056 pipe_default_auth_type = DCERPC_AUTH_TYPE_SPNEGO; 1048 1057 pipe_default_auth_spnego_type = PIPE_AUTH_TYPE_SPNEGO_NTLMSSP; 1049 1058 } 1050 if (b inding->flags & DCERPC_AUTH_NTLM) {1059 if (bflags & DCERPC_AUTH_NTLM) { 1051 1060 if (pipe_default_auth_type == DCERPC_AUTH_TYPE_SPNEGO) { 1052 1061 pipe_default_auth_spnego_type = PIPE_AUTH_TYPE_SPNEGO_NTLMSSP; … … 1055 1064 } 1056 1065 } 1057 if (b inding->flags & DCERPC_AUTH_KRB5) {1066 if (bflags & DCERPC_AUTH_KRB5) { 1058 1067 if (pipe_default_auth_type == DCERPC_AUTH_TYPE_SPNEGO) { 1059 1068 pipe_default_auth_spnego_type = PIPE_AUTH_TYPE_SPNEGO_KRB5; … … 1089 1098 } 1090 1099 1091 1092 nt_status = cli_full_connection(&cli, global_myname(), binding->host, 1100 nt_status = cli_full_connection(&cli, lp_netbios_name(), host, 1093 1101 opt_ipaddr ? &server_ss : NULL, opt_port, 1094 1102 "IPC$", "IPC", … … 1122 1130 1123 1131 /* Load command lists */ 1124 1125 timeout = cli_set_timeout(cli, 10000); 1132 rpcclient_cli_state = cli; 1133 1134 timeout = 10000; 1135 cli_set_timeout(cli, timeout); 1126 1136 1127 1137 cmd_set = rpcclient_command_list; … … 1133 1143 } 1134 1144 1135 default_transport = binding->transport;1145 default_transport = dcerpc_binding_get_transport(binding); 1136 1146 1137 1147 fetch_machine_sid(cli); … … 1170 1180 1171 1181 done: 1182 rpcclient_cli_state = NULL; 1172 1183 if (cli != NULL) { 1173 1184 cli_shutdown(cli); -
vendor/current/source3/rpcclient/rpcclient.h
r740 r988 36 36 const char **argv); 37 37 WERROR (*wfn)(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, int argc, const char **argv); 38 const struct ndr_ syntax_id *interface;38 const struct ndr_interface_table *table; 39 39 struct rpc_pipe_client *rpc_pipe; 40 40 const char *description; 41 41 const char *usage; 42 bool use_netlogon_creds; 42 43 }; 43 44 45 extern struct messaging_context *rpcclient_msg_ctx; 46 extern struct cli_state *rpcclient_cli_state; 47 extern struct netlogon_creds_cli_context *rpcclient_netlogon_creds; 48 44 49 #endif /* RPCCLIENT_H */
Note:
See TracChangeset
for help on using the changeset viewer.