Ignore:
Timestamp:
Nov 14, 2012, 12:59:34 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to 3.6.0

Location:
vendor/current/source4/utils
Files:
2 added
17 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source4/utils/man/ntlm_auth.1.xml

    r414 r740  
    11<?xml version="1.0" encoding="iso-8859-1"?>
    2 <!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
     2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
    33<refentry id="ntlm-auth.1">
    44
     
    204204        </varlistentry>
    205205
    206           &popt.common.samba;
    207           &stdarg.help;
    208        
    209206        </variablelist>
    210207</refsect1>
  • vendor/current/source4/utils/ntlm_auth.c

    r414 r740  
    2525#include "system/filesys.h"
    2626#include "lib/cmdline/popt_common.h"
    27 #include "lib/ldb/include/ldb.h"
     27#include <ldb.h>
    2828#include "auth/credentials/credentials.h"
    2929#include "auth/gensec/gensec.h"
     
    212212               
    213213                nt_status = ntlm_password_check(mem_ctx,
    214                                                 lp_lanman_auth(lp_ctx),
    215                                                 lp_ntlm_auth(lp_ctx),
     214                                                lpcfg_lanman_auth(lp_ctx),
     215                                                lpcfg_ntlm_auth(lp_ctx),
    216216                                                MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT |
    217217                                                MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT,
     
    226226                if (NT_STATUS_IS_OK(nt_status)) {
    227227                        if (unix_name) {
    228                                 asprintf(unix_name,
    229                                          "%s%c%s", domain,
    230                                          *lp_winbind_separator(lp_ctx),
    231                                          username);
     228                                if (asprintf(unix_name, "%s%c%s", domain,
     229                                             *lpcfg_winbind_separator(lp_ctx),
     230                                             username) < 0) {
     231                                        nt_status = NT_STATUS_NO_MEMORY;
     232                                }
    232233                        }
    233234                } else {
     
    477478
    478479                        nt_status = gensec_client_start(NULL, &state->gensec_state, ev,
    479                                                         lp_gensec_settings(NULL, lp_ctx));
     480                                                        lpcfg_gensec_settings(NULL, lp_ctx));
    480481                        if (!NT_STATUS_IS_OK(nt_status)) {
    481482                                talloc_free(mem_ctx);
     
    490491                        struct auth_context *auth_context;
    491492
    492                         msg = messaging_client_init(state, lp_messaging_path(state, lp_ctx),
    493                                                     lp_iconv_convenience(lp_ctx), ev);
     493                        msg = messaging_client_init(state, lpcfg_messaging_path(state, lp_ctx), ev);
    494494                        if (!msg) {
    495495                                talloc_free(mem_ctx);
     
    501501                                                                msg,
    502502                                                                lp_ctx,
     503                                                                NULL,
    503504                                                                &auth_context);
    504505       
     
    509510                       
    510511                        if (!NT_STATUS_IS_OK(gensec_server_start(state, ev,
    511                                                                  lp_gensec_settings(state, lp_ctx),
     512                                                                 lpcfg_gensec_settings(state, lp_ctx),
    512513                                                                 auth_context, &state->gensec_state))) {
    513514                                talloc_free(mem_ctx);
     
    617618                        struct security_token *token = session_info->security_token;
    618619                        const char *sidstr = dom_sid_string(session_info,
    619                                                             token->sids[i]);
     620                                                            &token->sids[i]);
    620621                        grouplist = talloc_asprintf_append_buffer(grouplist, "%s,", sidstr);
    621622                }
     
    647648
    648649        if (strncmp(buf, "GF", 2) == 0) {
    649                 struct gensec_ntlmssp_state *gensec_ntlmssp_state;
     650                struct ntlmssp_state *ntlmssp_state;
    650651                uint32_t neg_flags;
    651652
    652                 gensec_ntlmssp_state = talloc_get_type(state->gensec_state->private_data,
    653                                 struct gensec_ntlmssp_state);
    654                 neg_flags = gensec_ntlmssp_state->neg_flags;
     653                ntlmssp_state = talloc_get_type(state->gensec_state->private_data,
     654                                struct ntlmssp_state);
     655                neg_flags = ntlmssp_state->neg_flags;
    655656
    656657                DEBUG(10, ("Requested negotiated feature flags\n"));
     
    662663       
    663664        /* don't leak 'bad password'/'no such user' info to the network client */
    664         nt_status = auth_nt_status_squash(nt_status);
     665        nt_status = nt_status_squash(nt_status);
    665666
    666667        if (out.length) {
     
    702703                        reply_code = "BH Failed to retrive session info";
    703704                        reply_arg = nt_errstr(nt_status);
    704                         DEBUG(1, ("GENSEC failed to retreive the session info: %s\n", nt_errstr(nt_status)));
     705                        DEBUG(1, ("GENSEC failed to retrieve the session info: %s\n", nt_errstr(nt_status)));
    705706                } else {
    706707
    707708                        reply_code = "AF";
    708709                        reply_arg = talloc_asprintf(state->gensec_state,
    709                                                     "%s%s%s", session_info->server_info->domain_name,
    710                                                     lp_winbind_separator(lp_ctx), session_info->server_info->account_name);
     710                                                    "%s%s%s", session_info->info->domain_name,
     711                                                    lpcfg_winbind_separator(lp_ctx), session_info->info->account_name);
    711712                        talloc_free(session_info);
    712713                }
     
    760761                        /* handle this request as plaintext */
    761762                        if (!full_username) {
    762                                 if (asprintf(&full_username, "%s%c%s", domain, *lp_winbind_separator(lp_ctx), username) == -1) {
     763                                if (asprintf(&full_username, "%s%c%s", domain, *lpcfg_winbind_separator(lp_ctx), username) < 0) {
    763764                                        mux_printf(mux_id, "Error: Out of memory in asprintf!\n.\n");
    764765                                        return;
     
    785786                                if (!parse_ntlm_auth_domain_user(full_username, &username,
    786787                                                                                                 &domain,
    787                                                                                                  *lp_winbind_separator(lp_ctx))) {
     788                                                                                                 *lpcfg_winbind_separator(lp_ctx))) {
    788789                                        /* username might be 'tainted', don't print into our new-line deleimianted stream */
    789790                                        mux_printf(mux_id, "Error: Could not parse into domain and username\n");
     
    792793
    793794                        if (!domain) {
    794                                 domain = smb_xstrdup(lp_workgroup(lp_ctx));
     795                                domain = smb_xstrdup(lpcfg_workgroup(lp_ctx));
    795796                        }
    796797
     
    805806                                                             username,
    806807                                                              domain,
    807                                                               lp_netbios_name(lp_ctx),
     808                                                              lpcfg_netbios_name(lp_ctx),
    808809                                                              &challenge,
    809810                                                              &lm_response,
     
    933934}
    934935
    935 static void manage_squid_request(struct loadparm_context *lp_ctx, enum stdio_helper_mode helper_mode, 
     936static void manage_squid_request(struct loadparm_context *lp_ctx, enum stdio_helper_mode helper_mode,
    936937                                 stdio_helper_function fn, void **private2)
    937938{
     
    10401041}
    10411042
    1042 static void squid_stream(struct loadparm_context *lp_ctx, 
     1043static void squid_stream(struct loadparm_context *lp_ctx,
    10431044                         enum stdio_helper_mode stdio_mode,
    10441045                         stdio_helper_function fn) {
     
    11331134
    11341135        if (opt_domain == NULL) {
    1135                 opt_domain = lp_workgroup(cmdline_lp_ctx);
     1136                opt_domain = lpcfg_workgroup(cmdline_lp_ctx);
    11361137        }
    11371138
     
    11601161
    11611162        if (opt_workstation == NULL) {
    1162                 opt_workstation = lp_netbios_name(cmdline_lp_ctx);
     1163                opt_workstation = lpcfg_netbios_name(cmdline_lp_ctx);
    11631164        }
    11641165
     
    11701171                char *user;
    11711172
    1172                 asprintf(&user, "%s%c%s", opt_domain, *lp_winbind_separator(cmdline_lp_ctx), opt_username);
     1173                if (asprintf(&user, "%s%c%s", opt_domain,
     1174                             *lpcfg_winbind_separator(cmdline_lp_ctx),
     1175                             opt_username) < 0) {
     1176                        return 1;
     1177                }
    11731178                if (!check_plaintext_auth(user, opt_password, true)) {
    11741179                        return 1;
  • vendor/current/source4/utils/oLschema2ldif.c

    r414 r740  
    3636#include "tools/cmdline.h"
    3737#include "dsdb/samdb/samdb.h"
     38#include "../lib/crypto/sha256.h"
     39#include "../librpc/gen_ndr/ndr_misc.h"
     40#include "lib/cmdline/popt_common.h"
    3841
    3942#define SCHEMA_UNKNOWN 0
     
    337340        int n;
    338341
     342        SHA256_CTX sha256_context;
     343        uint8_t digest[SHA256_DIGEST_LENGTH];
     344
     345        struct GUID guid;
     346
     347        bool isAttribute = false;
     348        bool single_valued = false;
     349
    339350        ctx = talloc_new(mem_ctx);
    340351        msg = ldb_msg_new(ctx);
     
    352363                        c += 13;
    353364                        MSG_ADD_STRING("objectClass", "attributeSchema");
     365                        isAttribute = true;
    354366                        break;
    355367                }
     
    375387        n = strcspn(c, " \t");
    376388        s = talloc_strndup(msg, c, n);
    377         MSG_ADD_STRING("attributeID", s);
     389        if (isAttribute) {
     390                MSG_ADD_STRING("attributeID", s);
     391        } else {
     392                MSG_ADD_STRING("governsID", s);
     393        }
     394
     395        SHA256_Init(&sha256_context);
     396        SHA256_Update(&sha256_context, (uint8_t*)s, strlen(s));
     397        SHA256_Final(digest, &sha256_context);
     398
     399        memcpy(&guid, digest, sizeof(struct GUID));
     400
     401        if (dsdb_msg_add_guid(msg, &guid, "schemaIdGuid") != 0) {
     402                goto failed;
     403        }
     404
    378405        c += n;
    379406        c = skip_spaces(c);     
     
    417444
    418445                case SCHEMA_SINGLE_VALUE:
    419                         MSG_ADD_STRING("isSingleValued", "TRUE");
     446                        single_valued = true;
    420447                        break;
    421448
     
    434461                case SCHEMA_SYNTAX:
    435462                {
    436                         const struct dsdb_syntax *map =
    437                                 find_syntax_map_by_standard_oid(token->value);
     463                        char *syntax_oid;
     464                        const struct dsdb_syntax *map;
     465                        char *oMSyntax;
     466
     467                        n = strcspn(token->value, "{");
     468                        syntax_oid = talloc_strndup(ctx, token->value, n);
     469
     470                        map = find_syntax_map_by_standard_oid(syntax_oid);
    438471                        if (!map) {
    439472                                break;
    440473                        }
     474
    441475                        MSG_ADD_STRING("attributeSyntax", map->attributeSyntax_oid);
     476
     477                        oMSyntax = talloc_asprintf(msg, "%d", map->oMSyntax);
     478                        MSG_ADD_STRING("oMSyntax", oMSyntax);
     479
    442480                        break;
    443481                }
     
    449487                        fprintf(stderr, "Unknown Definition: %s\n", token->value);
    450488                }
     489        }
     490
     491        if (isAttribute) {
     492                MSG_ADD_STRING("isSingleValued", single_valued ? "TRUE" : "FALSE");
     493        } else {
     494                MSG_ADD_STRING("defaultObjectCategory", ldb_dn_get_linearized(msg->dn));
    451495        }
    452496
     
    541585}
    542586
     587static struct options {
     588        const char *basedn;
     589        const char *input;
     590        const char *output;
     591} options;
     592
     593static struct poptOption popt_options[] = {
     594        POPT_AUTOHELP
     595        { "basedn",    'b', POPT_ARG_STRING, &options.basedn, 0, "base DN", "DN" },
     596        { "input", 'I', POPT_ARG_STRING, &options.input, 0,
     597          "inputfile of OpenLDAP style schema otherwise STDIN", "inputfile"},
     598        { "output", 'O', POPT_ARG_STRING, &options.output, 0,
     599          "outputfile otherwise STDOUT", "outputfile"},
     600        POPT_COMMON_VERSION
     601        { NULL }
     602};
     603
     604
    543605static void usage(void)
    544606{
    545         printf("Usage: oLschema2ldif -H NONE <options>\n");
     607        poptContext pc;
     608        printf("Usage: oLschema2ldif <options>\n");
    546609        printf("\nConvert OpenLDAP schema to AD-like LDIF format\n\n");
    547         printf("Options:\n");
    548         printf("  -I inputfile     inputfile of OpenLDAP style schema otherwise STDIN\n");
    549         printf("  -O outputfile    outputfile otherwise STDOUT\n");
    550         printf("  -o options       pass options like modules to activate\n");
    551         printf("              e.g: -o modules:timestamps\n");
    552         printf("\n");
    553610        printf("Converts records from an openLdap formatted schema to an ldif schema\n\n");
     611        pc = poptGetContext("oLschema2ldif", 0, NULL, popt_options,
     612                            POPT_CONTEXT_KEEP_FIRST);
     613        poptPrintHelp(pc, stdout, 0);
    554614        exit(1);
    555615}
     616
    556617
    557618 int main(int argc, const char **argv)
     
    559620        TALLOC_CTX *ctx;
    560621        struct schema_conv ret;
    561         struct ldb_cmdline *options;
    562622        FILE *in = stdin;
    563623        FILE *out = stdout;
     624        poptContext pc;
     625        int opt;
     626
    564627        ctx = talloc_new(NULL);
    565628        ldb_ctx = ldb_init(ctx, NULL);
    566629
    567630        setenv("LDB_URL", "NONE", 1);
    568         options = ldb_cmdline_process(ldb_ctx, argc, argv, usage);
    569 
    570         if (options->basedn == NULL) {
    571                 perror("Base DN not specified");
     631
     632        pc = poptGetContext(argv[0], argc, argv, popt_options,
     633                            POPT_CONTEXT_KEEP_FIRST);
     634
     635        while((opt = poptGetNextOpt(pc)) != -1) {
     636                fprintf(stderr, "Invalid option %s: %s\n",
     637                        poptBadOption(pc, 0), poptStrerror(opt));
     638                usage();
     639        }
     640
     641        if (options.basedn == NULL) {           
     642                printf("Base DN not specified\n");
     643                usage();
    572644                exit(1);
    573645        } else {
    574                 basedn = ldb_dn_new(ctx, ldb_ctx, options->basedn);
     646                basedn = ldb_dn_new(ctx, ldb_ctx, options.basedn);
    575647                if ( ! ldb_dn_validate(basedn)) {
    576                         perror("Malformed Base DN");
     648                        printf("Malformed Base DN\n");
     649                        usage();
    577650                        exit(1);
    578651                }
    579652        }
    580653
    581         if (options->input) {
    582                 in = fopen(options->input, "r");
     654        if (options.input) {
     655                in = fopen(options.input, "r");
    583656                if (!in) {
    584                         perror(options->input);
     657                        perror(options.input);
     658                        usage();
    585659                        exit(1);
    586660                }
    587661        }
    588         if (options->output) {
    589                 out = fopen(options->output, "w");
     662        if (options.output) {
     663                out = fopen(options.output, "w");
    590664                if (!out) {
    591                         perror(options->output);
     665                        perror(options.output);
     666                        usage();
    592667                        exit(1);
    593668                }
Note: See TracChangeset for help on using the changeset viewer.