Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

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  
    66        <refentrytitle>oLschema2ldif</refentrytitle>
    77        <manvolnum>1</manvolnum>
     8        <refmiscinfo class="source">Samba</refmiscinfo>
     9        <refmiscinfo class="manual">System Administration tools</refmiscinfo>
     10        <refmiscinfo class="version">4.0</refmiscinfo>
    811</refmeta>
    912
  • vendor/current/source4/utils/ntlm_auth.c

    r740 r988  
    2828#include "auth/credentials/credentials.h"
    2929#include "auth/gensec/gensec.h"
     30#include "auth/gensec/gensec_internal.h" /* TODO: remove this */
    3031#include "auth/auth.h"
    3132#include "librpc/gen_ndr/ndr_netlogon.h"
     
    142143        return true;
    143144}
    144 
    145 /**
    146  * Decode a base64 string into a DATA_BLOB - simple and slow algorithm
    147  **/
    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 above
    165  **/
    166 static void base64_decode_inplace(char *s)
    167 {
    168         ldb_base64_decode(s);
    169 }
    170 
    171145
    172146
     
    292266
    293267        if (strlen(buf) > 3) {
    294                 in = base64_decode_data_blob(NULL, buf + 3);
     268                in = base64_decode_data_blob(buf + 3);
    295269        } else {
    296270                in = data_blob(NULL, 0);
     
    327301{
    328302        char *password = NULL;
    329        
     303        void *cb = cli_credentials_callback_data_void(credentials);
     304
    330305        /* Ask for a password */
    331         mux_printf((unsigned int)(uintptr_t)credentials->priv_data, "PW\n");
    332         credentials->priv_data = NULL;
     306        mux_printf((unsigned int)(uintptr_t)cb, "PW\n");
     307        cli_credentials_set_callback_data(credentials, NULL);
    333308
    334309        manage_squid_request(cmdline_lp_ctx, NUM_HELPER_MODES /* bogus */, manage_gensec_get_pw_request, (void **)&password);
     
    394369        struct gensec_ntlm_state *state;
    395370        struct tevent_context *ev;
    396         struct messaging_context *msg;
     371        struct imessaging_context *msg;
    397372
    398373        NTSTATUS nt_status;
     
    434409                        return;
    435410                }
    436                 in = base64_decode_data_blob(NULL, buf + 3);
     411                in = base64_decode_data_blob(buf + 3);
    437412        } else {
    438413                in = data_blob(NULL, 0);
     
    477452                        /* setup the client side */
    478453
    479                         nt_status = gensec_client_start(NULL, &state->gensec_state, ev,
     454                        nt_status = gensec_client_start(NULL, &state->gensec_state,
    480455                                                        lpcfg_gensec_settings(NULL, lp_ctx));
    481456                        if (!NT_STATUS_IS_OK(nt_status)) {
     
    489464                {
    490465                        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);
    494469                        if (!msg) {
    495470                                talloc_free(mem_ctx);
     
    509484                        }
    510485                       
    511                         if (!NT_STATUS_IS_OK(gensec_server_start(state, ev,
     486                        if (!NT_STATUS_IS_OK(gensec_server_start(state,
    512487                                                                 lpcfg_gensec_settings(state, lp_ctx),
    513488                                                                 auth_context, &state->gensec_state))) {
     
    533508                        cli_credentials_set_password(creds, state->set_password, CRED_SPECIFIED);
    534509                } else {
     510                        void *cb = (void*)(uintptr_t)mux_id;
     511                        cli_credentials_set_callback_data(creds, cb);
    535512                        cli_credentials_set_password_callback(creds, get_password);
    536                         creds->priv_data = (void*)(uintptr_t)mux_id;
    537513                }
    538514                if (opt_workstation) {
     
    603579                struct auth_session_info *session_info;
    604580
    605                 nt_status = gensec_session_info(state->gensec_state, &session_info);
     581                nt_status = gensec_session_info(state->gensec_state, mem_ctx, &session_info);
    606582                if (!NT_STATUS_IS_OK(nt_status)) {
    607583                        DEBUG(1, ("gensec_session_info failed: %s\n", nt_errstr(nt_status)));
     
    632608                char *base64_key;
    633609                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);
    635611                if(!NT_STATUS_IS_OK(nt_status)) {
    636612                        DEBUG(1, ("gensec_session_key failed: %s\n", nt_errstr(nt_status)));
     
    660636        }
    661637
    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);
    663639       
    664640        /* don't leak 'bad password'/'no such user' info to the network client */
     
    699675                struct auth_session_info *session_info;
    700676
    701                 nt_status = gensec_session_info(state->gensec_state, &session_info);
     677                nt_status = gensec_session_info(state->gensec_state, mem_ctx, &session_info);
    702678                if (!NT_STATUS_IS_OK(nt_status)) {
    703679                        reply_code = "BH Failed to retrive session info";
     
    821797                        } else {
    822798                                static char zeros[16];
    823                                 char *hex_lm_key;
    824                                 char *hex_user_session_key;
    825799
    826800                                mux_printf(mux_id, "Authenticated: Yes\n");
     
    830804                                    && (memcmp(zeros, lm_key.data,
    831805                                                                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);
    835809                                        mux_printf(mux_id, "LANMAN-Session-Key: %s\n", hex_lm_key);
    836                                         SAFE_FREE(hex_lm_key);
    837810                                }
    838811
     
    841814                                    && (memcmp(zeros, user_session_key.data,
    842815                                               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);
    846821                                        mux_printf(mux_id, "User-Session-Key: %s\n", hex_user_session_key);
    847                                         SAFE_FREE(hex_user_session_key);
    848822                                }
    849823                        }
     
    11311105        }
    11321106
    1133         gensec_init(cmdline_lp_ctx);
     1107        gensec_init();
    11341108
    11351109        if (opt_domain == NULL) {
     
    11651139
    11661140        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                }
    11681148        }
    11691149
  • vendor/current/source4/utils/oLschema2ldif.c

    r740 r988  
    3434#include "includes.h"
    3535#include "ldb.h"
    36 #include "tools/cmdline.h"
    3736#include "dsdb/samdb/samdb.h"
    3837#include "../lib/crypto/sha256.h"
     
    8382                if (c == NULL) return 1;
    8483                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                }
    8690                c++;
    8791        }
     
    349353
    350354        ctx = talloc_new(mem_ctx);
     355        if (ctx == NULL) {
     356                return NULL;
     357        }
    351358        msg = ldb_msg_new(ctx);
     359        if (msg == NULL) {
     360                goto failed;
     361        }
    352362
    353363        ldb_msg_add_string(msg, "objectClass", "top");
     
    393403        }
    394404
    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);
    398408
    399409        memcpy(&guid, digest, sizeof(struct GUID));
     
    539549                do {
    540550                        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) {
    543555                                        ret.count++;
    544556                                        ldif.msg = process_entry(ctx, entry);
     
    549561                                        }
    550562                                        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++;
    551568                                        break;
    552569                                }
  • vendor/current/source4/utils/tests/test_nmblookup.sh

    r414 r988  
    66SERVER=$3
    77SERVER_IP=$4
    8 shift 4
     8nmblookup=$5
     9shift 5
    910TORTURE_OPTIONS=$*
    1011
     
    2728}
    2829
    29 samba4bindir="$BUILDDIR/bin"
    30 nmblookup="$samba4bindir/nmblookup$EXEEXT"
    31 
    3230testit "nmblookup -U \$SERVER_IP \$SERVER" $nmblookup $TORTURE_OPTIONS -U $SERVER_IP $SERVER
    3331testit "nmblookup -U \$SERVER_IP \$NETBIOSNAME" $nmblookup $TORTURE_OPTIONS -U $SERVER_IP $NETBIOSNAME
  • vendor/current/source4/utils/tests/test_samba_tool.sh

    r740 r988  
    33
    44SERVER=$1
    5 USERNAME=$2
    6 PASSWORD=$3
    7 DOMAIN=$4
    8 shift 4
     5SERVER_IP=$2
     6USERNAME=$3
     7PASSWORD=$4
     8DOMAIN=$5
     9smbclient=$6
     10shift 6
    911
    1012failed=0
    1113
    12 samba4bindir="$BUILDDIR/bin"
    13 smbclient="$samba4bindir/smbclient$EXEEXT"
    14 samba_tool="$samba4bindir/samba-tool$EXEEXT"
     14samba4bindir="$BINDIR"
     15samba_tool="$samba4bindir/samba-tool"
    1516
    1617testit() {
     
    3637testit "time" $VALGRIND $samba_tool time $SERVER $CONFIGURATION  -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@
    3738
    38 # FIXME: testit "domainlevel.show" $VALGRIND $samba_tool domainlevel show $CONFIGURATION
     39testit "domain level.show" $VALGRIND $samba_tool domain level show
     40
     41testit "domain info" $VALGRIND $samba_tool domain info $SERVER_IP
     42
     43testit "fsmo show" $VALGRIND $samba_tool fsmo show
    3944
    4045exit $failed
  • vendor/current/source4/utils/wscript_build

    r740 r988  
    11#!/usr/bin/env python
    22
    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
     3bld.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
    911        )
    1012
     
    1315        source='oLschema2ldif.c',
    1416        manpages='man/oLschema2ldif.1',
    15         deps='ldb-cmdline samdb POPT_SAMBA'
     17        deps='samdb POPT_SAMBA'
    1618        )
    1719
Note: See TracChangeset for help on using the changeset viewer.