Ignore:
Timestamp:
Mar 12, 2008, 9:08:18 AM (17 years ago)
Author:
Paul Smedley
Message:

Update source to 3.0.28a

Location:
branches/samba-3.0/source/utils
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.0/source/utils/net.c

    r62 r124  
    676676                DEBUG(0, ("WARNING: Could not open passdb - domain sid may not reflect passdb\n"
    677677                          "backend knowlege (such as the sid stored in LDAP)\n"));
     678        }
     679
     680        /* first check to see if we can even access secrets, so we don't
     681           panic when we can't. */
     682
     683        if (!secrets_init()) {
     684                d_fprintf(stderr, "Unable to open secrets.tdb.  "
     685                                  "Can't fetch domainSID for name: %s\n",
     686                                  get_global_sam_name());
     687                return 1;
    678688        }
    679689
  • branches/samba-3.0/source/utils/net_domain.c

    r1 r124  
    210210        uint32 flags = 0x3e8;
    211211        uint32 acb_info = ACB_WSTRUST;
    212         uchar pwbuf[516];
     212        uint32 acct_flags=0;
     213        uint32 fields_present;
     214        uchar pwbuf[532];
    213215        SAM_USERINFO_CTR ctr;
    214         SAM_USER_INFO_24 p24;
    215         SAM_USER_INFO_16 p16;
     216        SAM_USER_INFO_25 p25;
     217        const int infolevel = 25;
     218        struct MD5Context md5ctx;
     219        uchar md5buffer[16];
     220        DATA_BLOB digested_session_key;
    216221        uchar md4_trust_password[16];
    217222
     
    243248        /* Don't try to set any acb_info flags other than ACB_WSTRUST */
    244249
     250        acct_flags = SAMR_GENERIC_READ | SAMR_GENERIC_WRITE |
     251                SAMR_GENERIC_EXECUTE | SAMR_STANDARD_WRITEDAC |
     252                SAMR_STANDARD_DELETE | SAMR_USER_SETPASS | SAMR_USER_GETATTR |
     253                SAMR_USER_SETATTR;
     254        DEBUG(10, ("Creating account with flags: %d\n",acct_flags));
    245255        status = rpccli_samr_create_dom_user(pipe_hnd, mem_ctx, &domain_pol,
    246                         acct_name, acb_info, 0xe005000b, &user_pol, &user_rid);
     256                        acct_name, acb_info, acct_flags, &user_pol, &user_rid);
    247257
    248258        if ( !NT_STATUS_IS_OK(status)
     
    284294        status = rpccli_samr_open_user(pipe_hnd, mem_ctx, &domain_pol,
    285295                        SEC_RIGHTS_MAXIMUM_ALLOWED, user_rid, &user_pol);
    286        
    287         /* Create a random machine account password */
    288 
    289         E_md4hash( clear_pw, md4_trust_password);
     296        if (!NT_STATUS_IS_OK(status)) {
     297                return status;
     298        }
     299       
     300        /* Create a random machine account password and generate the hash */
     301
     302        E_md4hash(clear_pw, md4_trust_password);
    290303        encode_pw_buffer(pwbuf, clear_pw, STR_UNICODE);
    291 
    292         /* Set password on machine account */
    293 
    294         ZERO_STRUCT(ctr);
    295         ZERO_STRUCT(p24);
    296 
    297         init_sam_user_info24(&p24, (char *)pwbuf,24);
    298 
    299         ctr.switch_value = 24;
    300         ctr.info.id24 = &p24;
    301 
    302         status = rpccli_samr_set_userinfo(pipe_hnd, mem_ctx, &user_pol,
    303                         24, &cli->user_session_key, &ctr);
    304 
    305         if ( !NT_STATUS_IS_OK(status) ) {
    306                 d_fprintf( stderr, "Failed to set password for machine account (%s)\n",
    307                         nt_errstr(status));
    308                 return status;
    309         }
    310 
    311 
    312         /* Why do we have to try to (re-)set the ACB to be the same as what
    313            we passed in the samr_create_dom_user() call?  When a NT
    314            workstation is joined to a domain by an administrator the
    315            acb_info is set to 0x80.  For a normal user with "Add
    316            workstations to the domain" rights the acb_info is 0x84.  I'm
    317            not sure whether it is supposed to make a difference or not.  NT
    318            seems to cope with either value so don't bomb out if the set
    319            userinfo2 level 0x10 fails.  -tpot */
    320 
    321         ZERO_STRUCT(ctr);
    322         ctr.switch_value = 16;
    323         ctr.info.id16 = &p16;
     304       
     305        generate_random_buffer((uint8*)md5buffer, sizeof(md5buffer));
     306        digested_session_key = data_blob_talloc(mem_ctx, 0, 16);
     307       
     308        MD5Init(&md5ctx);
     309        MD5Update(&md5ctx, md5buffer, sizeof(md5buffer));
     310        MD5Update(&md5ctx, cli->user_session_key.data, cli->user_session_key.length);
     311        MD5Final(digested_session_key.data, &md5ctx);
     312       
     313        SamOEMhashBlob(pwbuf, sizeof(pwbuf), &digested_session_key);
     314        memcpy(&pwbuf[516], md5buffer, sizeof(md5buffer));
    324315
    325316        /* Fill in the additional account flags now */
     
    333324        }
    334325
    335         init_sam_user_info16(&p16, acb_info);
    336 
    337         status = rpccli_samr_set_userinfo2(pipe_hnd, mem_ctx, &user_pol, 16,
    338                                         &cli->user_session_key, &ctr);
     326        /* Set password and account flags on machine account */
     327
     328        ZERO_STRUCT(ctr);
     329        ZERO_STRUCT(p25);
     330
     331        fields_present = ACCT_NT_PWD_SET | ACCT_LM_PWD_SET | ACCT_FLAGS;
     332        init_sam_user_info25P(&p25, fields_present, acb_info, (char *)pwbuf);
     333
     334        ctr.switch_value = infolevel;
     335        ctr.info.id25    = &p25;
     336
     337        status = rpccli_samr_set_userinfo2(pipe_hnd, mem_ctx, &user_pol,
     338                                           infolevel, &cli->user_session_key, &ctr);
     339
     340        if ( !NT_STATUS_IS_OK(status) ) {
     341                d_fprintf( stderr, "Failed to set password for machine account (%s)\n",
     342                        nt_errstr(status));
     343                return status;
     344        }
    339345
    340346        rpccli_samr_close(pipe_hnd, mem_ctx, &user_pol);
  • branches/samba-3.0/source/utils/net_rpc.c

    r62 r124  
    382382 *              stripped
    383383 *
    384  * Main 'net_rpc_join()' (where the admain username/password is used) is
     384 * Main 'net_rpc_join()' (where the admin username/password is used) is
    385385 * in net_rpc_join.c
    386386 * Try to just change the password, but if that doesn't work, use/prompt
     
    582582        const char *acct_name;
    583583        uint32 acb_info;
    584         uint32 unknown, user_rid;
     584        uint32 acct_flags=0;
     585        uint32 user_rid;
    585586
    586587        if (argc < 1) {
     
    612613
    613614        acb_info = ACB_NORMAL;
    614         unknown = 0xe005000b; /* No idea what this is - a permission mask? */
     615        acct_flags = SAMR_GENERIC_READ | SAMR_GENERIC_WRITE |
     616                SAMR_GENERIC_EXECUTE | SAMR_STANDARD_WRITEDAC |
     617                SAMR_STANDARD_DELETE | SAMR_USER_SETPASS | SAMR_USER_GETATTR |
     618                SAMR_USER_SETATTR;
     619        DEBUG(10, ("Creating account with flags: %d\n",acct_flags));
    615620
    616621        result = rpccli_samr_create_dom_user(pipe_hnd, mem_ctx, &domain_pol,
    617                                           acct_name, acb_info, unknown,
     622                                          acct_name, acb_info, acct_flags,
    618623                                          &user_pol, &user_rid);
    619624        if (!NT_STATUS_IS_OK(result)) {
     
    53365341        char *acct_name;
    53375342        uint32 acb_info;
    5338         uint32 unknown, user_rid;
     5343        uint32 user_rid;
     5344        uint32 acct_flags=0;
    53395345
    53405346        if (argc != 2) {
     
    53705376        /* Create trusting domain's account */
    53715377        acb_info = ACB_NORMAL;
    5372         unknown = 0xe00500b0; /* No idea what this is - a permission mask?
    5373                                  mimir: yes, most probably it is */
     5378        acct_flags = SAMR_GENERIC_READ | SAMR_GENERIC_WRITE |
     5379                SAMR_GENERIC_EXECUTE | SAMR_STANDARD_WRITEDAC |
     5380                SAMR_STANDARD_DELETE | SAMR_USER_SETPASS | SAMR_USER_GETATTR |
     5381                SAMR_USER_SETATTR;
    53745382
    53755383        result = rpccli_samr_create_dom_user(pipe_hnd, mem_ctx, &domain_pol,
    5376                                           acct_name, acb_info, unknown,
     5384                                          acct_name, acb_info, acct_flags,
    53775385                                          &user_pol, &user_rid);
    53785386        if (!NT_STATUS_IS_OK(result)) {
  • branches/samba-3.0/source/utils/net_rpc_join.c

    r1 r124  
    4444int net_rpc_join_ok(const char *domain, const char *server, struct in_addr *ip )
    4545{
    46         uint32 neg_flags = NETLOGON_NEG_AUTH2_FLAGS|NETLOGON_NEG_SCHANNEL;
     46        uint32 neg_flags = NETLOGON_NEG_SELECT_AUTH2_FLAGS|NETLOGON_NEG_SCHANNEL;
    4747        struct cli_state *cli = NULL;
    4848        struct rpc_pipe_client *pipe_hnd = NULL;
     
    115115        TALLOC_CTX *mem_ctx;
    116116        uint32 acb_info = ACB_WSTRUST;
    117         uint32 neg_flags = NETLOGON_NEG_AUTH2_FLAGS|(lp_client_schannel() ? NETLOGON_NEG_SCHANNEL : 0);
     117        uint32 neg_flags = NETLOGON_NEG_SELECT_AUTH2_FLAGS|(lp_client_schannel() ? NETLOGON_NEG_SCHANNEL : 0);
    118118        uint32 sec_channel_type;
    119119        struct rpc_pipe_client *pipe_hnd = NULL;
     
    143143        char *acct_name;
    144144        const char *const_acct_name;
     145        uint32 acct_flags=0;
    145146
    146147        /* check what type of join */
     
    230231        const_acct_name = acct_name;
    231232
     233        acct_flags = SAMR_GENERIC_READ | SAMR_GENERIC_WRITE |
     234                SAMR_GENERIC_EXECUTE | SAMR_STANDARD_WRITEDAC |
     235                SAMR_STANDARD_DELETE | SAMR_USER_SETPASS | SAMR_USER_GETATTR |
     236                SAMR_USER_SETATTR;
     237        DEBUG(10, ("Creating account with flags: %d\n",acct_flags));
    232238        result = rpccli_samr_create_dom_user(pipe_hnd, mem_ctx, &domain_pol,
    233239                                          acct_name, acb_info,
    234                                           0xe005000b, &user_pol,
     240                                          acct_flags, &user_pol,
    235241                                          &user_rid);
    236242
  • branches/samba-3.0/source/utils/net_rpc_samsync.c

    r39 r124  
    239239        NTSTATUS nt_status = NT_STATUS_UNSUCCESSFUL;
    240240        uchar trust_password[16];
    241         uint32 neg_flags = NETLOGON_NEG_AUTH2_FLAGS;
     241        uint32 neg_flags = NETLOGON_NEG_SELECT_AUTH2_FLAGS;
    242242        uint32 sec_channel_type = 0;
    243243
  • branches/samba-3.0/source/utils/net_sam.c

    r22 r124  
    4343        }
    4444
    45         if (!lookup_name(tmp_talloc_ctx(), argv[0], LOOKUP_NAME_ISOLATED,
     45        if (!lookup_name(tmp_talloc_ctx(), argv[0], LOOKUP_NAME_LOCAL,
    4646                         &dom, &name, &sid, &type)) {
    4747                d_fprintf(stderr, "Could not find name %s\n", argv[0]);
     
    140140        }
    141141
    142         if (!lookup_name(tmp_talloc_ctx(), argv[0], LOOKUP_NAME_ISOLATED,
     142        if (!lookup_name(tmp_talloc_ctx(), argv[0], LOOKUP_NAME_LOCAL,
    143143                         &dom, &name, &sid, &type)) {
    144144                d_fprintf(stderr, "Could not find name %s\n", argv[0]);
     
    224224        }
    225225
    226         if (!lookup_name(tmp_talloc_ctx(), argv[0], LOOKUP_NAME_ISOLATED,
     226        if (!lookup_name(tmp_talloc_ctx(), argv[0], LOOKUP_NAME_LOCAL,
    227227                         &dom, &name, &sid, &type)) {
    228228                d_fprintf(stderr, "Could not find name %s\n", argv[0]);
     
    285285        }
    286286
    287         if (!lookup_name(tmp_talloc_ctx(), argv[0], LOOKUP_NAME_ISOLATED,
     287        if (!lookup_name(tmp_talloc_ctx(), argv[0], LOOKUP_NAME_LOCAL,
    288288                         &dom, &name, &sid, &type)) {
    289289                d_fprintf(stderr, "Could not find name %s\n", argv[0]);
     
    640640        }
    641641
    642         if (!lookup_name(tmp_talloc_ctx(), argv[0], LOOKUP_NAME_ISOLATED,
     642        if (!lookup_name(tmp_talloc_ctx(), argv[0], LOOKUP_NAME_LOCAL,
    643643                         &groupdomain, &groupname, &group, &grouptype)) {
    644644                d_fprintf(stderr, "Could not find group %s\n", argv[0]);
     
    648648        /* check to see if the member to be added is a name or a SID */
    649649
    650         if (!lookup_name(tmp_talloc_ctx(), argv[1], LOOKUP_NAME_ISOLATED,
     650        if (!lookup_name(tmp_talloc_ctx(), argv[1], LOOKUP_NAME_LOCAL,
    651651                         &memberdomain, &membername, &member, &membertype))
    652652        {
     
    713713        }
    714714
    715         if (!lookup_name(tmp_talloc_ctx(), argv[0], LOOKUP_NAME_ISOLATED,
     715        if (!lookup_name(tmp_talloc_ctx(), argv[0], LOOKUP_NAME_LOCAL,
    716716                         &groupdomain, &groupname, &group, &grouptype)) {
    717717                d_fprintf(stderr, "Could not find group %s\n", argv[0]);
     
    719719        }
    720720
    721         if (!lookup_name(tmp_talloc_ctx(), argv[1], LOOKUP_NAME_ISOLATED,
     721        if (!lookup_name(tmp_talloc_ctx(), argv[1], LOOKUP_NAME_LOCAL,
    722722                         &memberdomain, &membername, &member, NULL)) {
    723723                if (!string_to_sid(&member, argv[1])) {
     
    771771        }
    772772
    773         if (!lookup_name(tmp_talloc_ctx(), argv[0], LOOKUP_NAME_ISOLATED,
     773        if (!lookup_name(tmp_talloc_ctx(), argv[0], LOOKUP_NAME_LOCAL,
    774774                         &groupdomain, &groupname, &group, &grouptype)) {
    775775                d_fprintf(stderr, "Could not find group %s\n", argv[0]);
     
    919919        }
    920920
    921         if (!lookup_name(tmp_talloc_ctx(), argv[0], LOOKUP_NAME_ISOLATED,
     921        if (!lookup_name(tmp_talloc_ctx(), argv[0], LOOKUP_NAME_LOCAL,
    922922                         &dom, &name, &sid, &type)) {
    923923                d_fprintf(stderr, "Could not find name %s\n", argv[0]);
  • branches/samba-3.0/source/utils/smbcacls.c

    r1 r124  
    789789                                                            share, "?????", 
    790790                                                            cmdline_auth_info.username, lp_workgroup(),
    791                                                             cmdline_auth_info.password, 0,
     791                                                            cmdline_auth_info.password,
     792                                                            cmdline_auth_info.use_kerberos ? CLI_FULL_CONNECTION_USE_KERBEROS : 0,
    792793                                                            cmdline_auth_info.signing_state, NULL))) {
    793794                return c;
  • branches/samba-3.0/source/utils/smbpasswd.c

    r30 r124  
    9797                switch(ch) {
    9898                case 'L':
     99#if !defined(DEVELOPER)
     100                        if (getuid() != 0) {
     101                                fprintf(stderr, "smbpasswd -L can only be used by root.\n");
     102                                exit(1);
     103                        }
     104#endif
    99105                        local_flags |= LOCAL_AM_ROOT;
    100106                        break;
  • branches/samba-3.0/source/utils/status.c

    r30 r124  
    368368                int ret;
    369369
     370                tdb = tdb_open_log(lock_path("locking.tdb"), 0, TDB_DEFAULT, O_RDONLY, 0);
     371
     372                if (!tdb) {
     373                        d_printf("%s not initialised\n", lock_path("locking.tdb"));
     374                        d_printf("This is normal if an SMB client has never connected to your server.\n");
     375                        exit(0);
     376                } else {
     377                        tdb_close(tdb);
     378                }
     379
    370380                if (!locking_init(1)) {
    371381                        d_printf("Can't initialise locking module - exiting\n");
Note: See TracChangeset for help on using the changeset viewer.