Changeset 745 for trunk/server/source3/utils/net_ads.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
source3/utils/net_ads.c (modified) (23 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source3/utils/net_ads.c
r596 r745 23 23 #include "includes.h" 24 24 #include "utils/net.h" 25 25 26 #include "librpc/gen_ndr/ndr_krb5pac.h" 26 #include "../librpc/gen_ndr/ cli_spoolss.h"27 #include "../librpc/gen_ndr/_spoolss.h" 27 28 #include "nsswitch/libwbclient/wbclient.h" 29 30 31 32 33 34 35 36 37 38 39 28 40 29 41 #ifdef HAVE_ADS … … 104 116 printf(_("Domain Controller:\t%s\n"), reply.pdc_dns_name); 105 117 106 printf(_("Pre-Win2k Domain:\t%s\n"), reply.domain );118 printf(_("Pre-Win2k Domain:\t%s\n"), reply.domain); 107 119 printf(_("Pre-Win2k Hostname:\t%s\n"), reply.pdc_name); 108 120 … … 402 414 } 403 415 404 d_printf(_("Workgroup: %s\n"), reply.domain );416 d_printf(_("Workgroup: %s\n"), reply.domain); 405 417 406 418 ads_destroy(&ads); … … 476 488 ou_str = SMB_STRDUP(c->opt_container); 477 489 } else { 478 ou_str = ads_default_ou_string(ads, WELL_KNOWN_GUID_USERS);490 ou_str = ads_default_ou_string(ads, ); 479 491 } 480 492 … … 540 552 char *primary_group; 541 553 char *escaped_user; 542 DOM_SIDprimary_group_sid;554 primary_group_sid; 543 555 uint32_t group_rid; 544 556 enum wbcSidType type; … … 770 782 ou_str = SMB_STRDUP(c->opt_container); 771 783 } else { 772 ou_str = ads_default_ou_string(ads, WELL_KNOWN_GUID_USERS);784 ou_str = ads_default_ou_string(ads, ); 773 785 } 774 786 … … 959 971 } 960 972 973 974 975 976 977 978 961 979 werr = libnet_init_UnjoinCtx(ctx, &r); 962 980 if (!W_ERROR_IS_OK(werr)) { … … 978 996 WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE; 979 997 r->in.delete_machine_account = true; 998 980 999 981 1000 werr = libnet_Unjoin(ctx, r); … … 1104 1123 1105 1124 #if defined(WITH_DNS_UPDATES) 1106 #include " dns.h"1125 #include "dns.h" 1107 1126 DNS_ERROR DoDNSUpdate(char *pszServerName, 1108 1127 const char *pszDomainName, const char *pszHostName, … … 1116 1135 { 1117 1136 struct dns_rr_ns *nameservers = NULL; 1118 int ns_count = 0 ;1137 int ns_count = 0; 1119 1138 NTSTATUS status = NT_STATUS_UNSUCCESSFUL; 1120 1139 DNS_ERROR dns_err; … … 1181 1200 } 1182 1201 1183 /* Now perform the dns update - we'll try non-secure and if we fail, 1184 we'll follow it up with a secure update */ 1185 1186 fstrcpy( dns_server, nameservers[0].hostname ); 1187 1188 dns_err = DoDNSUpdate(dns_server, dnsdomain, machine_name, addrs, num_addrs); 1189 if (!ERR_DNS_IS_OK(dns_err)) { 1202 for (i=0; i < ns_count; i++) { 1203 1204 /* Now perform the dns update - we'll try non-secure and if we fail, 1205 we'll follow it up with a secure update */ 1206 1207 fstrcpy( dns_server, nameservers[i].hostname ); 1208 1209 dns_err = DoDNSUpdate(dns_server, dnsdomain, machine_name, addrs, num_addrs); 1210 if (ERR_DNS_IS_OK(dns_err)) { 1211 status = NT_STATUS_OK; 1212 goto done; 1213 } 1214 1215 if (ERR_DNS_EQUAL(dns_err, ERROR_DNS_INVALID_NAME_SERVER) || 1216 ERR_DNS_EQUAL(dns_err, ERROR_DNS_CONNECTION_FAILED) || 1217 ERR_DNS_EQUAL(dns_err, ERROR_DNS_SOCKET_ERROR)) { 1218 DEBUG(1,("retrying DNS update with next nameserver after receiving %s\n", 1219 dns_errstr(dns_err))); 1220 continue; 1221 } 1222 1223 d_printf(_("DNS Update for %s failed: %s\n"), 1224 machine_name, dns_errstr(dns_err)); 1190 1225 status = NT_STATUS_UNSUCCESSFUL; 1226 1191 1227 } 1192 1228 … … 1348 1384 d_fprintf(stderr, _("Please supply a valid domain name\n")); 1349 1385 werr = WERR_INVALID_PARAM; 1386 1387 1388 1389 1390 1391 1392 1350 1393 goto fail; 1351 1394 } … … 1368 1411 WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE | 1369 1412 WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED; 1413 1370 1414 1371 1415 werr = libnet_Join(ctx, r); 1416 1417 1418 1419 1420 1372 1421 if (!W_ERROR_IS_OK(werr)) { 1373 1422 goto fail; … … 1438 1487 ads_destroy(&ads_dns); 1439 1488 } 1489 1490 1440 1491 #endif 1441 1492 1442 done:1443 1493 TALLOC_FREE(r); 1444 1494 TALLOC_FREE( ctx ); … … 1583 1633 err = do_gethostbyname(argv[0], argv[1]); 1584 1634 1585 d_printf(_("do_gethostbyname returned %d\n"), ERROR_DNS_V(err)); 1635 d_printf(_("do_gethostbyname returned %s (%d)\n"), 1636 dns_errstr(err), ERROR_DNS_V(err)); 1586 1637 #endif 1587 1638 return 0; … … 1783 1834 c->opt_password ? c->opt_password : "", 1784 1835 CLI_FULL_CONNECTION_USE_KERBEROS, 1785 Undefined , NULL);1836 Undefined); 1786 1837 1787 1838 if (NT_STATUS_IS_ERR(nt_status)) { 1788 d_fprintf(stderr, _("Unable to open a conn nection to %s to "1839 d_fprintf(stderr, _("Unable to open a connection to %s to " 1789 1840 "obtain data for %s\n"), 1790 1841 servername, printername); … … 1835 1886 nt_status = cli_rpc_pipe_open_noauth(cli, &ndr_table_spoolss.syntax_id, &pipe_hnd); 1836 1887 if (!NT_STATUS_IS_OK(nt_status)) { 1837 d_fprintf(stderr, _("Unable to open a conn nection to the spoolss pipe on %s\n"),1888 d_fprintf(stderr, _("Unable to open a connection to the spoolss pipe on %s\n"), 1838 1889 servername); 1839 1890 SAFE_FREE(prt_dn); … … 2265 2316 const char **attrs; 2266 2317 LDAPMessage *res = NULL; 2267 DOM_SIDsid;2318 sid; 2268 2319 2269 2320 if (argc < 1 || c->display_usage) { … … 2463 2514 static int net_ads_kerberos_pac(struct net_context *c, int argc, const char **argv) 2464 2515 { 2465 struct PAC_DATA *pac = NULL;2466 2516 struct PAC_LOGON_INFO *info = NULL; 2467 2517 TALLOC_CTX *mem_ctx = NULL; … … 2493 2543 c->opt_user_name, 2494 2544 c->opt_password, 2495 0,2545 0, 2496 2546 NULL, 2497 2547 NULL, … … 2501 2551 2592000, /* one month */ 2502 2552 impersonate_princ_s, 2503 & pac);2553 &); 2504 2554 if (!NT_STATUS_IS_OK(status)) { 2505 2555 d_printf(_("failed to query kerberos PAC: %s\n"), … … 2508 2558 } 2509 2559 2510 info = get_logon_info_from_pac(pac);2511 2560 if (info) { 2512 2561 const char *s; … … 2794 2843 } 2795 2844 2845 2846 2847 2848 2849 2796 2850 /* this one shouldn't display a message */ 2797 2851 int net_ads_check(struct net_context *c)
Note:
See TracChangeset
for help on using the changeset viewer.
