Changeset 745 for trunk/server/source3/libnet/libnet_join.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
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/libnet/libnet_join.c
r599 r745 20 20 21 21 #include "includes.h" 22 #include "libnet/libnet.h" 22 #include "ads.h" 23 #include "librpc/gen_ndr/ndr_libnet_join.h" 24 #include "libnet/libnet_join.h" 23 25 #include "libcli/auth/libcli_auth.h" 24 #include "../librpc/gen_ndr/cli_samr.h" 25 #include "../librpc/gen_ndr/cli_lsa.h" 26 #include "../librpc/gen_ndr/ndr_samr_c.h" 27 #include "rpc_client/init_samr.h" 28 #include "../librpc/gen_ndr/ndr_lsa_c.h" 29 #include "rpc_client/cli_lsarpc.h" 30 #include "../librpc/gen_ndr/ndr_netlogon.h" 31 #include "rpc_client/cli_netlogon.h" 32 #include "lib/smbconf/smbconf.h" 33 #include "lib/smbconf/smbconf_reg.h" 34 #include "../libds/common/flags.h" 35 #include "secrets.h" 36 #include "rpc_client/init_lsa.h" 37 #include "rpc_client/cli_pipe.h" 38 #include "krb5_env.h" 39 #include "../libcli/security/security.h" 40 #include "passdb.h" 41 #include "libsmb/libsmb.h" 26 42 27 43 /**************************************************************** … … 90 106 } 91 107 92 #ifdef WITH_ADS108 #ifdef HAVE_ADS 93 109 94 110 /**************************************************************** … … 630 646 return ADS_SUCCESS; 631 647 } 632 #endif /* WITH_ADS */648 #endif /* HAVE_ADS */ 633 649 634 650 /**************************************************************** … … 685 701 pass, 686 702 flags, 687 Undefined , NULL);703 Undefined); 688 704 } 689 705 … … 698 714 struct rpc_pipe_client *pipe_hnd = NULL; 699 715 struct policy_handle lsa_pol; 700 NTSTATUS status = NT_STATUS_UNSUCCESSFUL;716 NTSTATUS status, result; 701 717 union lsa_PolicyInformation *info = NULL; 718 struct dcerpc_binding_handle *b; 702 719 703 720 status = libnet_join_connect_dc_ipc(r->in.dc_name, … … 718 735 } 719 736 737 b = pipe_hnd->binding_handle; 738 720 739 status = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, true, 721 740 SEC_FLAG_MAXIMUM_ALLOWED, &lsa_pol); … … 724 743 } 725 744 726 status = rpccli_lsa_QueryInfoPolicy2(pipe_hnd, mem_ctx,745 status = dcerpc_lsa_QueryInfoPolicy2(b, mem_ctx, 727 746 &lsa_pol, 728 747 LSA_POLICY_INFO_DNS, 729 &info); 730 if (NT_STATUS_IS_OK(status)) { 748 &info, 749 &result); 750 if (NT_STATUS_IS_OK(status) && NT_STATUS_IS_OK(result)) { 731 751 r->out.domain_is_ad = true; 732 752 r->out.netbios_domain_name = info->dns.name.string; 733 753 r->out.dns_domain_name = info->dns.dns_domain.string; 734 754 r->out.forest_name = info->dns.dns_forest.string; 735 r->out.domain_sid = sid_dup_talloc(mem_ctx, info->dns.sid);755 r->out.domain_sid = dom_sid_dup(mem_ctx, info->dns.sid); 736 756 NT_STATUS_HAVE_NO_MEMORY(r->out.domain_sid); 737 757 } 738 758 739 759 if (!NT_STATUS_IS_OK(status)) { 740 status = rpccli_lsa_QueryInfoPolicy(pipe_hnd, mem_ctx,760 status = dcerpc_lsa_QueryInfoPolicy(b, mem_ctx, 741 761 &lsa_pol, 742 762 LSA_POLICY_INFO_ACCOUNT_DOMAIN, 743 &info); 763 &info, 764 &result); 744 765 if (!NT_STATUS_IS_OK(status)) { 745 766 goto done; 746 767 } 768 if (!NT_STATUS_IS_OK(result)) { 769 status = result; 770 goto done; 771 } 747 772 748 773 r->out.netbios_domain_name = info->account_domain.name.string; 749 r->out.domain_sid = sid_dup_talloc(mem_ctx, info->account_domain.sid);774 r->out.domain_sid = dom_sid_dup(mem_ctx, info->account_domain.sid); 750 775 NT_STATUS_HAVE_NO_MEMORY(r->out.domain_sid); 751 776 } 752 777 753 rpccli_lsa_Close(pipe_hnd, mem_ctx, &lsa_pol);778 dcerpc_lsa_Close(b, mem_ctx, &lsa_pol, &result); 754 779 TALLOC_FREE(pipe_hnd); 755 780 … … 818 843 struct rpc_pipe_client *pipe_hnd = NULL; 819 844 struct policy_handle sam_pol, domain_pol, user_pol; 820 NTSTATUS status = NT_STATUS_UNSUCCESSFUL ;845 NTSTATUS status = NT_STATUS_UNSUCCESSFUL, result; 821 846 char *acct_name; 822 847 struct lsa_String lsa_acct_name; … … 826 851 struct samr_Ids name_types; 827 852 union samr_UserInfo user_info; 853 struct dcerpc_binding_handle *b = NULL; 828 854 829 855 struct samr_CryptPassword crypt_pwd; … … 860 886 } 861 887 862 status = rpccli_samr_Connect2(pipe_hnd, mem_ctx, 888 b = pipe_hnd->binding_handle; 889 890 status = dcerpc_samr_Connect2(b, mem_ctx, 863 891 pipe_hnd->desthost, 864 892 SAMR_ACCESS_ENUM_DOMAINS 865 893 | SAMR_ACCESS_LOOKUP_DOMAIN, 866 &sam_pol); 867 if (!NT_STATUS_IS_OK(status)) { 868 goto done; 869 } 870 871 status = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx, 894 &sam_pol, 895 &result); 896 if (!NT_STATUS_IS_OK(status)) { 897 goto done; 898 } 899 if (!NT_STATUS_IS_OK(result)) { 900 status = result; 901 goto done; 902 } 903 904 status = dcerpc_samr_OpenDomain(b, mem_ctx, 872 905 &sam_pol, 873 906 SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1 … … 875 908 | SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT, 876 909 r->out.domain_sid, 877 &domain_pol); 878 if (!NT_STATUS_IS_OK(status)) { 910 &domain_pol, 911 &result); 912 if (!NT_STATUS_IS_OK(status)) { 913 goto done; 914 } 915 if (!NT_STATUS_IS_OK(result)) { 916 status = result; 879 917 goto done; 880 918 } … … 899 937 access_desired)); 900 938 901 status = rpccli_samr_CreateUser2(pipe_hnd, mem_ctx,939 status = dcerpc_samr_CreateUser2(b, mem_ctx, 902 940 &domain_pol, 903 941 &lsa_acct_name, … … 906 944 &user_pol, 907 945 &access_granted, 908 &user_rid); 946 &user_rid, 947 &result); 948 if (!NT_STATUS_IS_OK(status)) { 949 goto done; 950 } 951 952 status = result; 909 953 if (!NT_STATUS_IS_OK(status) && 910 954 !NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { … … 936 980 937 981 if (NT_STATUS_IS_OK(status)) { 938 rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);939 } 940 } 941 942 status = rpccli_samr_LookupNames(pipe_hnd, mem_ctx,982 dcerpc_samr_Close(b, mem_ctx, &user_pol, &result); 983 } 984 } 985 986 status = dcerpc_samr_LookupNames(b, mem_ctx, 943 987 &domain_pol, 944 988 1, 945 989 &lsa_acct_name, 946 990 &user_rids, 947 &name_types); 948 if (!NT_STATUS_IS_OK(status)) { 991 &name_types, 992 &result); 993 if (!NT_STATUS_IS_OK(status)) { 994 goto done; 995 } 996 if (!NT_STATUS_IS_OK(result)) { 997 status = result; 949 998 goto done; 950 999 } … … 961 1010 /* Open handle on user */ 962 1011 963 status = rpccli_samr_OpenUser(pipe_hnd, mem_ctx,1012 status = dcerpc_samr_OpenUser(b, mem_ctx, 964 1013 &domain_pol, 965 1014 SEC_FLAG_MAXIMUM_ALLOWED, 966 1015 user_rid, 967 &user_pol); 968 if (!NT_STATUS_IS_OK(status)) { 1016 &user_pol, 1017 &result); 1018 if (!NT_STATUS_IS_OK(status)) { 1019 goto done; 1020 } 1021 if (!NT_STATUS_IS_OK(result)) { 1022 status = result; 969 1023 goto done; 970 1024 } … … 973 1027 974 1028 acct_flags |= ACB_PWNOEXP; 975 if (r->out.domain_is_ad) {976 #if !defined(ENCTYPE_ARCFOUR_HMAC)977 acct_flags |= ACB_USE_DES_KEY_ONLY;978 #endif979 ;;980 }981 1029 982 1030 /* Set account flags on machine account */ … … 984 1032 user_info.info16.acct_flags = acct_flags; 985 1033 986 status = rpccli_samr_SetUserInfo(pipe_hnd, mem_ctx,1034 status = dcerpc_samr_SetUserInfo(b, mem_ctx, 987 1035 &user_pol, 988 1036 16, 989 &user_info );990 991 if (!NT_STATUS_IS_OK(status)) { 992 993 rpccli_samr_DeleteUser(pipe_hnd, mem_ctx,994 & user_pol);1037 &user_info, 1038 &result); 1039 if (!NT_STATUS_IS_OK(status)) { 1040 dcerpc_samr_DeleteUser(b, mem_ctx, 1041 &user_pol, 1042 &result); 995 1043 996 1044 libnet_join_set_error_string(mem_ctx, r, … … 1000 1048 } 1001 1049 1050 if (!NT_STATUS_IS_OK(result)) { 1051 status = result; 1052 1053 dcerpc_samr_DeleteUser(b, mem_ctx, 1054 &user_pol, 1055 &result); 1056 1057 libnet_join_set_error_string(mem_ctx, r, 1058 "Failed to set account flags for machine account (%s)\n", 1059 nt_errstr(status)); 1060 goto done; 1061 } 1062 1002 1063 /* Set password on machine account - first try level 26 */ 1003 1064 … … 1009 1070 user_info.info26.password_expired = PASS_DONT_CHANGE_AT_NEXT_LOGON; 1010 1071 1011 status = rpccli_samr_SetUserInfo2(pipe_hnd, mem_ctx,1072 status = dcerpc_samr_SetUserInfo2(b, mem_ctx, 1012 1073 &user_pol, 1013 1074 26, 1014 &user_info); 1015 1016 if (NT_STATUS_EQUAL(status, NT_STATUS(DCERPC_FAULT_INVALID_TAG))) { 1075 &user_info, 1076 &result); 1077 1078 if (NT_STATUS_EQUAL(status, NT_STATUS_RPC_ENUM_VALUE_OUT_OF_RANGE)) { 1017 1079 1018 1080 /* retry with level 24 */ … … 1025 1087 user_info.info24.password_expired = PASS_DONT_CHANGE_AT_NEXT_LOGON; 1026 1088 1027 status = rpccli_samr_SetUserInfo2(pipe_hnd, mem_ctx,1089 status = dcerpc_samr_SetUserInfo2(b, mem_ctx, 1028 1090 &user_pol, 1029 1091 24, 1030 &user_info); 1031 } 1032 1033 if (!NT_STATUS_IS_OK(status)) { 1034 1035 rpccli_samr_DeleteUser(pipe_hnd, mem_ctx, 1036 &user_pol); 1092 &user_info, 1093 &result); 1094 } 1095 1096 if (!NT_STATUS_IS_OK(status)) { 1097 1098 dcerpc_samr_DeleteUser(b, mem_ctx, 1099 &user_pol, 1100 &result); 1037 1101 1038 1102 libnet_join_set_error_string(mem_ctx, r, … … 1041 1105 goto done; 1042 1106 } 1107 if (!NT_STATUS_IS_OK(result)) { 1108 status = result; 1109 1110 dcerpc_samr_DeleteUser(b, mem_ctx, 1111 &user_pol, 1112 &result); 1113 1114 libnet_join_set_error_string(mem_ctx, r, 1115 "Failed to set password for machine account (%s)\n", 1116 nt_errstr(status)); 1117 goto done; 1118 } 1043 1119 1044 1120 status = NT_STATUS_OK; … … 1050 1126 1051 1127 if (is_valid_policy_hnd(&sam_pol)) { 1052 rpccli_samr_Close(pipe_hnd, mem_ctx, &sam_pol);1128 dcerpc_samr_Close(b, mem_ctx, &sam_pol, &result); 1053 1129 } 1054 1130 if (is_valid_policy_hnd(&domain_pol)) { 1055 rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol);1131 dcerpc_samr_Close(b, mem_ctx, &domain_pol, &result); 1056 1132 } 1057 1133 if (is_valid_policy_hnd(&user_pol)) { 1058 rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol);1134 dcerpc_samr_Close(b, mem_ctx, &user_pol, &result); 1059 1135 } 1060 1136 TALLOC_FREE(pipe_hnd); … … 1105 1181 machine_password, 1106 1182 0, 1107 Undefined , NULL);1183 Undefined); 1108 1184 free(machine_account); 1109 1185 free(machine_password); … … 1118 1194 "", 1119 1195 0, 1120 Undefined , NULL);1196 Undefined); 1121 1197 } 1122 1198 … … 1210 1286 struct rpc_pipe_client *pipe_hnd = NULL; 1211 1287 struct policy_handle sam_pol, domain_pol, user_pol; 1212 NTSTATUS status = NT_STATUS_UNSUCCESSFUL ;1288 NTSTATUS status = NT_STATUS_UNSUCCESSFUL, result; 1213 1289 char *acct_name; 1214 1290 uint32_t user_rid; … … 1217 1293 struct samr_Ids name_types; 1218 1294 union samr_UserInfo *info = NULL; 1295 struct dcerpc_binding_handle *b = NULL; 1219 1296 1220 1297 ZERO_STRUCT(sam_pol); … … 1241 1318 } 1242 1319 1243 status = rpccli_samr_Connect2(pipe_hnd, mem_ctx, 1320 b = pipe_hnd->binding_handle; 1321 1322 status = dcerpc_samr_Connect2(b, mem_ctx, 1244 1323 pipe_hnd->desthost, 1245 1324 SEC_FLAG_MAXIMUM_ALLOWED, 1246 &sam_pol); 1247 if (!NT_STATUS_IS_OK(status)) { 1248 goto done; 1249 } 1250 1251 status = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx, 1325 &sam_pol, 1326 &result); 1327 if (!NT_STATUS_IS_OK(status)) { 1328 goto done; 1329 } 1330 if (!NT_STATUS_IS_OK(result)) { 1331 status = result; 1332 goto done; 1333 } 1334 1335 status = dcerpc_samr_OpenDomain(b, mem_ctx, 1252 1336 &sam_pol, 1253 1337 SEC_FLAG_MAXIMUM_ALLOWED, 1254 1338 r->in.domain_sid, 1255 &domain_pol); 1256 if (!NT_STATUS_IS_OK(status)) { 1339 &domain_pol, 1340 &result); 1341 if (!NT_STATUS_IS_OK(status)) { 1342 goto done; 1343 } 1344 if (!NT_STATUS_IS_OK(result)) { 1345 status = result; 1257 1346 goto done; 1258 1347 } … … 1265 1354 init_lsa_String(&lsa_acct_name, acct_name); 1266 1355 1267 status = rpccli_samr_LookupNames(pipe_hnd, mem_ctx,1356 status = dcerpc_samr_LookupNames(b, mem_ctx, 1268 1357 &domain_pol, 1269 1358 1, 1270 1359 &lsa_acct_name, 1271 1360 &user_rids, 1272 &name_types); 1273 1274 if (!NT_STATUS_IS_OK(status)) { 1361 &name_types, 1362 &result); 1363 1364 if (!NT_STATUS_IS_OK(status)) { 1365 goto done; 1366 } 1367 if (!NT_STATUS_IS_OK(result)) { 1368 status = result; 1275 1369 goto done; 1276 1370 } … … 1287 1381 /* Open handle on user */ 1288 1382 1289 status = rpccli_samr_OpenUser(pipe_hnd, mem_ctx,1383 status = dcerpc_samr_OpenUser(b, mem_ctx, 1290 1384 &domain_pol, 1291 1385 SEC_FLAG_MAXIMUM_ALLOWED, 1292 1386 user_rid, 1293 &user_pol); 1294 if (!NT_STATUS_IS_OK(status)) { 1387 &user_pol, 1388 &result); 1389 if (!NT_STATUS_IS_OK(status)) { 1390 goto done; 1391 } 1392 if (!NT_STATUS_IS_OK(result)) { 1393 status = result; 1295 1394 goto done; 1296 1395 } … … 1298 1397 /* Get user info */ 1299 1398 1300 status = rpccli_samr_QueryUserInfo(pipe_hnd, mem_ctx,1399 status = dcerpc_samr_QueryUserInfo(b, mem_ctx, 1301 1400 &user_pol, 1302 1401 16, 1303 &info); 1304 if (!NT_STATUS_IS_OK(status)) { 1305 rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol); 1402 &info, 1403 &result); 1404 if (!NT_STATUS_IS_OK(status)) { 1405 dcerpc_samr_Close(b, mem_ctx, &user_pol, &result); 1406 goto done; 1407 } 1408 if (!NT_STATUS_IS_OK(result)) { 1409 status = result; 1410 dcerpc_samr_Close(b, mem_ctx, &user_pol, &result); 1306 1411 goto done; 1307 1412 } … … 1311 1416 info->info16.acct_flags |= ACB_DISABLED; 1312 1417 1313 status = rpccli_samr_SetUserInfo(pipe_hnd, mem_ctx,1418 status = dcerpc_samr_SetUserInfo(b, mem_ctx, 1314 1419 &user_pol, 1315 1420 16, 1316 info); 1317 1318 rpccli_samr_Close(pipe_hnd, mem_ctx, &user_pol); 1421 info, 1422 &result); 1423 if (!NT_STATUS_IS_OK(status)) { 1424 dcerpc_samr_Close(b, mem_ctx, &user_pol, &result); 1425 goto done; 1426 } 1427 if (!NT_STATUS_IS_OK(result)) { 1428 status = result; 1429 dcerpc_samr_Close(b, mem_ctx, &user_pol, &result); 1430 goto done; 1431 } 1432 status = result; 1433 dcerpc_samr_Close(b, mem_ctx, &user_pol, &result); 1319 1434 1320 1435 done: 1321 if (pipe_hnd ) {1436 if (pipe_hnd && b) { 1322 1437 if (is_valid_policy_hnd(&domain_pol)) { 1323 rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol);1438 dcerpc_samr_Close(b, mem_ctx, &domain_pol, &result); 1324 1439 } 1325 1440 if (is_valid_policy_hnd(&sam_pol)) { 1326 rpccli_samr_Close(pipe_hnd, mem_ctx, &sam_pol);1441 dcerpc_samr_Close(b, mem_ctx, &sam_pol, &result); 1327 1442 } 1328 1443 TALLOC_FREE(pipe_hnd); … … 1341 1456 static WERROR do_join_modify_vals_config(struct libnet_JoinCtx *r) 1342 1457 { 1343 WERROR werr; 1458 WERROR werr = WERR_OK; 1459 sbcErr err; 1344 1460 struct smbconf_ctx *ctx; 1345 1461 1346 werr = smbconf_init_reg(r, &ctx, NULL); 1347 if (!W_ERROR_IS_OK(werr)) { 1462 err = smbconf_init_reg(r, &ctx, NULL); 1463 if (!SBC_ERROR_IS_OK(err)) { 1464 werr = WERR_NO_SUCH_SERVICE; 1348 1465 goto done; 1349 1466 } … … 1351 1468 if (!(r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE)) { 1352 1469 1353 werr = smbconf_set_global_parameter(ctx, "security", "user"); 1354 W_ERROR_NOT_OK_GOTO_DONE(werr); 1355 1356 werr = smbconf_set_global_parameter(ctx, "workgroup", 1357 r->in.domain_name); 1470 err = smbconf_set_global_parameter(ctx, "security", "user"); 1471 if (!SBC_ERROR_IS_OK(err)) { 1472 werr = WERR_NO_SUCH_SERVICE; 1473 goto done; 1474 } 1475 1476 err = smbconf_set_global_parameter(ctx, "workgroup", 1477 r->in.domain_name); 1478 if (!SBC_ERROR_IS_OK(err)) { 1479 werr = WERR_NO_SUCH_SERVICE; 1480 goto done; 1481 } 1358 1482 1359 1483 smbconf_delete_global_parameter(ctx, "realm"); … … 1361 1485 } 1362 1486 1363 werr = smbconf_set_global_parameter(ctx, "security", "domain"); 1364 W_ERROR_NOT_OK_GOTO_DONE(werr); 1365 1366 werr = smbconf_set_global_parameter(ctx, "workgroup", 1367 r->out.netbios_domain_name); 1368 W_ERROR_NOT_OK_GOTO_DONE(werr); 1487 err = smbconf_set_global_parameter(ctx, "security", "domain"); 1488 if (!SBC_ERROR_IS_OK(err)) { 1489 werr = WERR_NO_SUCH_SERVICE; 1490 goto done; 1491 } 1492 1493 err = smbconf_set_global_parameter(ctx, "workgroup", 1494 r->out.netbios_domain_name); 1495 if (!SBC_ERROR_IS_OK(err)) { 1496 werr = WERR_NO_SUCH_SERVICE; 1497 goto done; 1498 } 1369 1499 1370 1500 if (r->out.domain_is_ad) { 1371 werr = smbconf_set_global_parameter(ctx, "security", "ads"); 1372 W_ERROR_NOT_OK_GOTO_DONE(werr); 1373 1374 werr = smbconf_set_global_parameter(ctx, "realm", 1375 r->out.dns_domain_name); 1376 W_ERROR_NOT_OK_GOTO_DONE(werr); 1501 err = smbconf_set_global_parameter(ctx, "security", "ads"); 1502 if (!SBC_ERROR_IS_OK(err)) { 1503 werr = WERR_NO_SUCH_SERVICE; 1504 goto done; 1505 } 1506 1507 err = smbconf_set_global_parameter(ctx, "realm", 1508 r->out.dns_domain_name); 1509 if (!SBC_ERROR_IS_OK(err)) { 1510 werr = WERR_NO_SUCH_SERVICE; 1511 goto done; 1512 } 1377 1513 } 1378 1514 … … 1388 1524 { 1389 1525 WERROR werr = WERR_OK; 1526 sbcErr err; 1390 1527 struct smbconf_ctx *ctx; 1391 1528 1392 werr = smbconf_init_reg(r, &ctx, NULL); 1393 if (!W_ERROR_IS_OK(werr)) { 1529 err = smbconf_init_reg(r, &ctx, NULL); 1530 if (!SBC_ERROR_IS_OK(err)) { 1531 werr = WERR_NO_SUCH_SERVICE; 1394 1532 goto done; 1395 1533 } … … 1397 1535 if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) { 1398 1536 1399 werr = smbconf_set_global_parameter(ctx, "security", "user"); 1400 W_ERROR_NOT_OK_GOTO_DONE(werr); 1401 1402 werr = smbconf_delete_global_parameter(ctx, "workgroup"); 1403 W_ERROR_NOT_OK_GOTO_DONE(werr); 1537 err = smbconf_set_global_parameter(ctx, "security", "user"); 1538 if (!SBC_ERROR_IS_OK(err)) { 1539 werr = WERR_NO_SUCH_SERVICE; 1540 goto done; 1541 } 1542 1543 err = smbconf_delete_global_parameter(ctx, "workgroup"); 1544 if (!SBC_ERROR_IS_OK(err)) { 1545 werr = WERR_NO_SUCH_SERVICE; 1546 goto done; 1547 } 1404 1548 1405 1549 smbconf_delete_global_parameter(ctx, "realm"); … … 1599 1743 } 1600 1744 1601 #ifdef WITH_ADS1745 #ifdef HAVE_ADS 1602 1746 if (r->out.domain_is_ad && 1603 1747 !(r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_UNSECURE)) { … … 1609 1753 } 1610 1754 } 1611 #endif /* WITH_ADS */1755 #endif /* HAVE_ADS */ 1612 1756 1613 1757 libnet_join_add_dom_rids_to_builtins(r->out.domain_sid); … … 1817 1961 WERROR werr; 1818 1962 struct cli_state *cli = NULL; 1819 #ifdef WITH_ADS1963 #ifdef HAVE_ADS 1820 1964 ADS_STATUS ads_status; 1821 #endif /* WITH_ADS */1965 #endif /* HAVE_ADS */ 1822 1966 1823 1967 if (!r->in.dc_name) { … … 1860 2004 } 1861 2005 1862 #ifdef WITH_ADS 2006 #ifdef HAVE_ADS 2007 2008 create_local_private_krb5_conf_for_domain( 2009 r->out.dns_domain_name, r->out.netbios_domain_name, 2010 NULL, &cli->dest_ss, cli->desthost); 2011 1863 2012 if (r->out.domain_is_ad && r->in.account_ou && 1864 2013 !(r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_UNSECURE)) { … … 1880 2029 r->in.join_flags &= ~WKSSVC_JOIN_FLAGS_ACCOUNT_CREATE; 1881 2030 } 1882 #endif /* WITH_ADS */2031 #endif /* HAVE_ADS */ 1883 2032 1884 2033 if ((r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_UNSECURE) && … … 1955 2104 } 1956 2105 2106 ZERO_STRUCT(r->out); 2107 1957 2108 werr = libnet_join_pre_processing(mem_ctx, r); 1958 2109 if (!W_ERROR_IS_OK(werr)) { … … 2003 2154 return WERR_SETUP_NOT_JOINED; 2004 2155 } 2005 r->in.domain_sid = sid_dup_talloc(mem_ctx, &sid);2156 r->in.domain_sid = dom_sid_dup(mem_ctx, &sid); 2006 2157 W_ERROR_HAVE_NO_MEMORY(r->in.domain_sid); 2007 2158 } … … 2038 2189 } 2039 2190 2040 #ifdef WITH_ADS2191 #ifdef HAVE_ADS 2041 2192 /* for net ads leave, try to delete the account. If it works, 2042 2193 no sense in disabling. If it fails, we can still try to 2043 2194 disable it. jmcd */ 2044 2195 2045 2196 if (r->in.delete_machine_account) { 2046 2197 ADS_STATUS ads_status; … … 2065 2216 } 2066 2217 } 2067 #endif /* WITH_ADS */2218 #endif /* HAVE_ADS */ 2068 2219 2069 2220 /* The WKSSVC_JOIN_FLAGS_ACCOUNT_DELETE flag really means … … 2080 2231 return ntstatus_to_werror(status); 2081 2232 } 2082 2233 2083 2234 r->out.disabled_machine_account = true; 2084 2235 }
Note:
See TracChangeset
for help on using the changeset viewer.