Changeset 988 for vendor/current/source4/utils
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- Location:
- vendor/current/source4/utils
- Files:
-
- 3 added
- 2 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source4/utils/man/oLschema2ldif.1.xml
r414 r988 6 6 <refentrytitle>oLschema2ldif</refentrytitle> 7 7 <manvolnum>1</manvolnum> 8 <refmiscinfo class="source">Samba</refmiscinfo> 9 <refmiscinfo class="manual">System Administration tools</refmiscinfo> 10 <refmiscinfo class="version">4.0</refmiscinfo> 8 11 </refmeta> 9 12 -
vendor/current/source4/utils/ntlm_auth.c
r740 r988 28 28 #include "auth/credentials/credentials.h" 29 29 #include "auth/gensec/gensec.h" 30 #include "auth/gensec/gensec_internal.h" /* TODO: remove this */ 30 31 #include "auth/auth.h" 31 32 #include "librpc/gen_ndr/ndr_netlogon.h" … … 142 143 return true; 143 144 } 144 145 /**146 * Decode a base64 string into a DATA_BLOB - simple and slow algorithm147 **/148 static DATA_BLOB base64_decode_data_blob(TALLOC_CTX *mem_ctx, const char *s)149 {150 DATA_BLOB ret = data_blob_talloc(mem_ctx, s, strlen(s)+1);151 ret.length = ldb_base64_decode((char *)ret.data);152 return ret;153 }154 155 /**156 * Encode a base64 string into a talloc()ed string caller to free.157 **/158 static char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data)159 {160 return ldb_base64_encode(mem_ctx, (const char *)data.data, data.length);161 }162 163 /**164 * Decode a base64 string in-place - wrapper for the above165 **/166 static void base64_decode_inplace(char *s)167 {168 ldb_base64_decode(s);169 }170 171 145 172 146 … … 292 266 293 267 if (strlen(buf) > 3) { 294 in = base64_decode_data_blob( NULL,buf + 3);268 in = base64_decode_data_blob(buf + 3); 295 269 } else { 296 270 in = data_blob(NULL, 0); … … 327 301 { 328 302 char *password = NULL; 329 303 void *cb = cli_credentials_callback_data_void(credentials); 304 330 305 /* Ask for a password */ 331 mux_printf((unsigned int)(uintptr_t)c redentials->priv_data, "PW\n");332 c redentials->priv_data = NULL;306 mux_printf((unsigned int)(uintptr_t)cb, "PW\n"); 307 cli_credentials_set_callback_data(credentials, NULL); 333 308 334 309 manage_squid_request(cmdline_lp_ctx, NUM_HELPER_MODES /* bogus */, manage_gensec_get_pw_request, (void **)&password); … … 394 369 struct gensec_ntlm_state *state; 395 370 struct tevent_context *ev; 396 struct messaging_context *msg;371 struct imessaging_context *msg; 397 372 398 373 NTSTATUS nt_status; … … 434 409 return; 435 410 } 436 in = base64_decode_data_blob( NULL,buf + 3);411 in = base64_decode_data_blob(buf + 3); 437 412 } else { 438 413 in = data_blob(NULL, 0); … … 477 452 /* setup the client side */ 478 453 479 nt_status = gensec_client_start(NULL, &state->gensec_state, ev,454 nt_status = gensec_client_start(NULL, &state->gensec_state, 480 455 lpcfg_gensec_settings(NULL, lp_ctx)); 481 456 if (!NT_STATUS_IS_OK(nt_status)) { … … 489 464 { 490 465 const char *winbind_method[] = { "winbind", NULL }; 491 struct auth _context *auth_context;492 493 msg = messaging_client_init(state, lpcfg_messaging_path(state, lp_ctx), ev);466 struct auth4_context *auth_context; 467 468 msg = imessaging_client_init(state, lp_ctx, ev); 494 469 if (!msg) { 495 470 talloc_free(mem_ctx); … … 509 484 } 510 485 511 if (!NT_STATUS_IS_OK(gensec_server_start(state, ev,486 if (!NT_STATUS_IS_OK(gensec_server_start(state, 512 487 lpcfg_gensec_settings(state, lp_ctx), 513 488 auth_context, &state->gensec_state))) { … … 533 508 cli_credentials_set_password(creds, state->set_password, CRED_SPECIFIED); 534 509 } else { 510 void *cb = (void*)(uintptr_t)mux_id; 511 cli_credentials_set_callback_data(creds, cb); 535 512 cli_credentials_set_password_callback(creds, get_password); 536 creds->priv_data = (void*)(uintptr_t)mux_id;537 513 } 538 514 if (opt_workstation) { … … 603 579 struct auth_session_info *session_info; 604 580 605 nt_status = gensec_session_info(state->gensec_state, &session_info);581 nt_status = gensec_session_info(state->gensec_state, mem_ctx, &session_info); 606 582 if (!NT_STATUS_IS_OK(nt_status)) { 607 583 DEBUG(1, ("gensec_session_info failed: %s\n", nt_errstr(nt_status))); … … 632 608 char *base64_key; 633 609 DEBUG(10, ("Requested session key\n")); 634 nt_status = gensec_session_key(state->gensec_state, &session_key);610 nt_status = gensec_session_key(state->gensec_state, mem_ctx, &session_key); 635 611 if(!NT_STATUS_IS_OK(nt_status)) { 636 612 DEBUG(1, ("gensec_session_key failed: %s\n", nt_errstr(nt_status))); … … 660 636 } 661 637 662 nt_status = gensec_update (state->gensec_state, mem_ctx, in, &out);638 nt_status = gensec_update_ev(state->gensec_state, mem_ctx, ev, in, &out); 663 639 664 640 /* don't leak 'bad password'/'no such user' info to the network client */ … … 699 675 struct auth_session_info *session_info; 700 676 701 nt_status = gensec_session_info(state->gensec_state, &session_info);677 nt_status = gensec_session_info(state->gensec_state, mem_ctx, &session_info); 702 678 if (!NT_STATUS_IS_OK(nt_status)) { 703 679 reply_code = "BH Failed to retrive session info"; … … 821 797 } else { 822 798 static char zeros[16]; 823 char *hex_lm_key;824 char *hex_user_session_key;825 799 826 800 mux_printf(mux_id, "Authenticated: Yes\n"); … … 830 804 && (memcmp(zeros, lm_key.data, 831 805 lm_key.length) != 0)) { 832 hex_encode(lm_key.data,833 lm_key.length,834 &hex_lm_key);806 char hex_lm_key[lm_key.length*2+1]; 807 hex_encode_buf(hex_lm_key, lm_key.data, 808 lm_key.length); 835 809 mux_printf(mux_id, "LANMAN-Session-Key: %s\n", hex_lm_key); 836 SAFE_FREE(hex_lm_key);837 810 } 838 811 … … 841 814 && (memcmp(zeros, user_session_key.data, 842 815 user_session_key.length) != 0)) { 843 hex_encode(user_session_key.data, 844 user_session_key.length, 845 &hex_user_session_key); 816 char hex_user_session_key[ 817 user_session_key.length*2+1]; 818 hex_encode_buf(hex_user_session_key, 819 user_session_key.data, 820 user_session_key.length); 846 821 mux_printf(mux_id, "User-Session-Key: %s\n", hex_user_session_key); 847 SAFE_FREE(hex_user_session_key);848 822 } 849 823 } … … 1131 1105 } 1132 1106 1133 gensec_init( cmdline_lp_ctx);1107 gensec_init(); 1134 1108 1135 1109 if (opt_domain == NULL) { … … 1165 1139 1166 1140 if (!opt_password) { 1167 opt_password = getpass("password: "); 1141 char pwd[256] = {0}; 1142 int rc; 1143 1144 rc = samba_getpass("Password: ", pwd, sizeof(pwd), false, false); 1145 if (rc == 0) { 1146 opt_password = smb_xstrdup(pwd); 1147 } 1168 1148 } 1169 1149 -
vendor/current/source4/utils/oLschema2ldif.c
r740 r988 34 34 #include "includes.h" 35 35 #include "ldb.h" 36 #include "tools/cmdline.h"37 36 #include "dsdb/samdb/samdb.h" 38 37 #include "../lib/crypto/sha256.h" … … 83 82 if (c == NULL) return 1; 84 83 if (*c == '(') b++; 85 if (*c == ')') b--; 84 if (*c == ')') { 85 b--; 86 if (*(c - 1) != ' ' && c && (*(c + 1) == '\0')) { 87 return 2; 88 } 89 } 86 90 c++; 87 91 } … … 349 353 350 354 ctx = talloc_new(mem_ctx); 355 if (ctx == NULL) { 356 return NULL; 357 } 351 358 msg = ldb_msg_new(ctx); 359 if (msg == NULL) { 360 goto failed; 361 } 352 362 353 363 ldb_msg_add_string(msg, "objectClass", "top"); … … 393 403 } 394 404 395 SHA256_Init(&sha256_context);396 SHA256_Update(&sha256_context, (uint8_t*)s, strlen(s));397 SHA256_Final(digest, &sha256_context);405 samba_SHA256_Init(&sha256_context); 406 samba_SHA256_Update(&sha256_context, (uint8_t*)s, strlen(s)); 407 samba_SHA256_Final(digest, &sha256_context); 398 408 399 409 memcpy(&guid, digest, sizeof(struct GUID)); … … 539 549 do { 540 550 if (c == '\n') { 541 entry[t] = '\0'; 542 if (check_braces(entry) == 0) { 551 int ret2 = 0; 552 entry[t] = '\0'; 553 ret2 = check_braces(entry); 554 if (ret2 == 0) { 543 555 ret.count++; 544 556 ldif.msg = process_entry(ctx, entry); … … 549 561 } 550 562 ldb_ldif_write_file(ldb_ctx, out, &ldif); 563 break; 564 } 565 if (ret2 == 2) { 566 fprintf(stderr, "Invalid entry %s, closing braces need to be preceded by a space\n", entry); 567 ret.failures++; 551 568 break; 552 569 } -
vendor/current/source4/utils/tests/test_nmblookup.sh
r414 r988 6 6 SERVER=$3 7 7 SERVER_IP=$4 8 shift 4 8 nmblookup=$5 9 shift 5 9 10 TORTURE_OPTIONS=$* 10 11 … … 27 28 } 28 29 29 samba4bindir="$BUILDDIR/bin"30 nmblookup="$samba4bindir/nmblookup$EXEEXT"31 32 30 testit "nmblookup -U \$SERVER_IP \$SERVER" $nmblookup $TORTURE_OPTIONS -U $SERVER_IP $SERVER 33 31 testit "nmblookup -U \$SERVER_IP \$NETBIOSNAME" $nmblookup $TORTURE_OPTIONS -U $SERVER_IP $NETBIOSNAME -
vendor/current/source4/utils/tests/test_samba_tool.sh
r740 r988 3 3 4 4 SERVER=$1 5 USERNAME=$2 6 PASSWORD=$3 7 DOMAIN=$4 8 shift 4 5 SERVER_IP=$2 6 USERNAME=$3 7 PASSWORD=$4 8 DOMAIN=$5 9 smbclient=$6 10 shift 6 9 11 10 12 failed=0 11 13 12 samba4bindir="$BUILDDIR/bin" 13 smbclient="$samba4bindir/smbclient$EXEEXT" 14 samba_tool="$samba4bindir/samba-tool$EXEEXT" 14 samba4bindir="$BINDIR" 15 samba_tool="$samba4bindir/samba-tool" 15 16 16 17 testit() { … … 36 37 testit "time" $VALGRIND $samba_tool time $SERVER $CONFIGURATION -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@ 37 38 38 # FIXME: testit "domainlevel.show" $VALGRIND $samba_tool domainlevel show $CONFIGURATION 39 testit "domain level.show" $VALGRIND $samba_tool domain level show 40 41 testit "domain info" $VALGRIND $samba_tool domain info $SERVER_IP 42 43 testit "fsmo show" $VALGRIND $samba_tool fsmo show 39 44 40 45 exit $failed -
vendor/current/source4/utils/wscript_build
r740 r988 1 1 #!/usr/bin/env python 2 2 3 bld.SAMBA_BINARY('ntlm_auth', 4 source='ntlm_auth.c', 5 manpages='man/ntlm_auth.1', 6 deps='''samba-hostconfig samba-util popt POPT_SAMBA POPT_CREDENTIALS gensec LIBCLI_RESOLVE 7 auth4 NTLMSSP_COMMON MESSAGING events service''', 8 pyembed=True 3 bld.SAMBA_BINARY('ntlm_auth4', 4 source='ntlm_auth.c', 5 manpages='man/ntlm_auth4.1', 6 deps='''samba-hostconfig samba-util popt 7 POPT_SAMBA POPT_CREDENTIALS gensec LIBCLI_RESOLVE 8 auth4 NTLMSSP_COMMON MESSAGING events service''', 9 pyembed=True, 10 install=False 9 11 ) 10 12 … … 13 15 source='oLschema2ldif.c', 14 16 manpages='man/oLschema2ldif.1', 15 deps=' ldb-cmdlinesamdb POPT_SAMBA'17 deps='samdb POPT_SAMBA' 16 18 ) 17 19
Note:
See TracChangeset
for help on using the changeset viewer.