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

Update source to 3.0.28a

Location:
branches/samba-3.0/source/smbd
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.0/source/smbd/build_options.c

    r62 r124  
    492492        output(screen, "   HAVE_STRING_H\n");
    493493#endif
     494#ifdef HAVE_STROPTS_H
     495        output(screen, "   HAVE_STROPTS_H\n");
     496#endif
    494497#ifdef HAVE_SYSCALL_H
    495498        output(screen, "   HAVE_SYSCALL_H\n");
     
    11241127        output(screen, "   HAVE_INOTIFY\n");
    11251128#endif
     1129#ifdef HAVE_INOTIFY_INIT
     1130        output(screen, "   HAVE_INOTIFY_INIT\n");
     1131#endif
    11261132#ifdef HAVE_IPRINT
    11271133        output(screen, "   HAVE_IPRINT\n");
     
    12651271        output(screen, "   HAVE_KRB5_PRINCIPAL_GET_COMP_STRING\n");
    12661272#endif
     1273#ifdef HAVE_KRB5_PRINCIPAL_GET_REALM
     1274        output(screen, "   HAVE_KRB5_PRINCIPAL_GET_REALM\n");
     1275#endif
    12671276#ifdef HAVE_KRB5_PRINC_COMPONENT
    12681277        output(screen, "   HAVE_KRB5_PRINC_COMPONENT\n");
    12691278#endif
     1279#ifdef HAVE_KRB5_PRINC_REALM
     1280        output(screen, "   HAVE_KRB5_PRINC_REALM\n");
     1281#endif
    12701282#ifdef HAVE_KRB5_PRINC_SIZE
    12711283        output(screen, "   HAVE_KRB5_PRINC_SIZE\n");
     
    13031315#ifdef HAVE_KV5M_KEYTAB
    13041316        output(screen, "   HAVE_KV5M_KEYTAB\n");
     1317#endif
     1318#ifdef HAVE_LBER_LOG_PRINT_FN
     1319        output(screen, "   HAVE_LBER_LOG_PRINT_FN\n");
    13051320#endif
    13061321#ifdef HAVE_LDAP
     
    24342449        output(screen, "   REPLACE_GETPASS\n");
    24352450#endif
     2451#ifdef REPLACE_GETPASS_BY_GETPASSPHRASE
     2452        output(screen, "   REPLACE_GETPASS_BY_GETPASSPHRASE\n");
     2453#endif
    24362454#ifdef REPLACE_INET_NTOA
    24372455        output(screen, "   REPLACE_INET_NTOA\n");
     
    29462964#ifdef vfs_netatalk_init
    29472965        output(screen, "   vfs_netatalk_init\n");
     2966#endif
     2967#ifdef vfs_notify_fam_init
     2968        output(screen, "   vfs_notify_fam_init\n");
    29482969#endif
    29492970#ifdef vfs_posixacl_init
  • branches/samba-3.0/source/smbd/chgpasswd.c

    r1 r124  
    127127        gid_t gid;
    128128        uid_t uid;
     129        char * const eptrs[1] = { NULL };
    129130
    130131        if (pass == NULL)
     
    154155                return (False);
    155156        }
    156 #if defined(I_PUSH) && defined(I_FIND)
     157#if defined(TIOCSCTTY)
     158        if (ioctl(slave, TIOCSCTTY, 0) < 0)
     159        {
     160                DEBUG(3, ("Error in ioctl call for slave pty\n"));
     161                /* return(False); */
     162        }
     163#elif defined(I_PUSH) && defined(I_FIND)
    157164        if (ioctl(slave, I_FIND, "ptem") == 0) {
    158165                ioctl(slave, I_PUSH, "ptem");
     
    160167        if (ioctl(slave, I_FIND, "ldterm") == 0) {
    161168                ioctl(slave, I_PUSH, "ldterm");
    162         }
    163 #elif defined(TIOCSCTTY)
    164         if (ioctl(slave, TIOCSCTTY, 0) < 0)
    165         {
    166                 DEBUG(3, ("Error in ioctl call for slave pty\n"));
    167                 /* return(False); */
    168169        }
    169170#endif
     
    223224
    224225        /* execl() password-change application */
    225         if (execl("/bin/sh", "sh", "-c", passwordprogram, NULL) < 0)
     226        if (execle("/bin/sh", "sh", "-c", passwordprogram, NULL, eptrs) < 0)
    226227        {
    227228                DEBUG(3, ("Bad status returned from %s\n", passwordprogram));
     
    499500        if (lp_pam_password_change()) {
    500501                BOOL ret;
     502#ifdef HAVE_SETLOCALE
     503                char *prevlocale = setlocale(LC_ALL, "C");
     504#endif
    501505
    502506                if (as_root)
     
    511515                if (as_root)
    512516                        unbecome_root();
     517
     518#ifdef HAVE_SETLOCALE
     519                setlocale(LC_ALL, prevlocale);
     520#endif
    513521
    514522                return ret;
  • branches/samba-3.0/source/smbd/dosmode.c

    r57 r124  
    453453
    454454        DEBUG(10,("file_set_dosmode: setting dos mode 0x%x on file %s\n", dosmode, fname));
    455         if (!st || (st && !VALID_STAT(*st))) {
     455
     456        if (st == NULL) {
     457                SET_STAT_INVALID(st1);
    456458                st = &st1;
     459        }
     460
     461        if (!VALID_STAT(*st)) {
    457462                if (SMB_VFS_STAT(conn,fname,st))
    458463                        return(-1);
    459464        }
     465
     466        unixmode = st->st_mode;
    460467
    461468        get_acl_group_bits(conn, fname, &st->st_mode);
     
    466473                dosmode &= ~aDIR;
    467474
    468         if (dos_mode(conn,fname,st) == dosmode)
     475        if (dos_mode(conn,fname,st) == dosmode) {
     476                st->st_mode = unixmode;
    469477                return(0);
     478        }
    470479
    471480        /* Store the DOS attributes in an EA by preference. */
    472481        if (set_ea_dos_attribute(conn, fname, st, dosmode)) {
     482                st->st_mode = unixmode;
    473483                return 0;
    474484        }
     
    509519                notify_fname(conn, NOTIFY_ACTION_MODIFIED,
    510520                             FILE_NOTIFY_CHANGE_ATTRIBUTES, fname);
     521                st->st_mode = unixmode;
    511522                return 0;
    512523        }
     
    541552                notify_fname(conn, NOTIFY_ACTION_MODIFIED,
    542553                             FILE_NOTIFY_CHANGE_ATTRIBUTES, fname);
     554                if (ret == 0) {
     555                        st->st_mode = unixmode;
     556                }
    543557        }
    544558
  • branches/samba-3.0/source/smbd/notify.c

    r62 r124  
    6666        int i;
    6767        UNISTR uni_name;
     68
     69        uni_name.buffer = NULL;
    6870
    6971        for (i=0; i<num_changes; i++) {
  • branches/samba-3.0/source/smbd/notify_inotify.c

    r39 r124  
    3131#endif
    3232
     33#ifndef HAVE_INOTIFY_INIT
     34
    3335#include <linux/inotify.h>
    3436#include <asm/unistd.h>
    3537
    36 #ifndef HAVE_INOTIFY_INIT
     38
    3739/*
    3840  glibc doesn't define these functions yet (as of March 2006)
     
    5254        return syscall(__NR_inotify_rm_watch, fd, wd);
    5355}
     56#else
     57
     58#include <sys/inotify.h>
     59
    5460#endif
    5561
  • branches/samba-3.0/source/smbd/open.c

    r105 r124  
    13761376#endif /* O_SYNC */
    13771377 
    1378         if (posix_open & (access_mask & FILE_APPEND_DATA)) {
     1378        if (posix_open && (access_mask & FILE_APPEND_DATA)) {
    13791379                flags2 |= O_APPEND;
    13801380        }
     
    18191819                    lp_store_dos_attributes(SNUM(conn))) {
    18201820                        if (!posix_open) {
    1821                                 file_set_dosmode(conn, fname,
    1822                                          new_dos_attributes | aARCH, NULL,
    1823                                          parent_dir);
     1821                                SMB_STRUCT_STAT tmp_sbuf;
     1822                                SET_STAT_INVALID(tmp_sbuf);
     1823                                if (file_set_dosmode(
     1824                                                conn, fname,
     1825                                                new_dos_attributes | aARCH,
     1826                                                &tmp_sbuf,
     1827                                                parent_dir) == 0) {
     1828                                        unx_mode = tmp_sbuf.st_mode;
     1829                                }
    18241830                        }
    18251831                }
  • branches/samba-3.0/source/smbd/password.c

    r118 r124  
    9292        if (vuser == NULL)
    9393                return;
    94        
     94
    9595        SAFE_FREE(vuser->homedir);
    9696        SAFE_FREE(vuser->unix_homedir);
    9797        SAFE_FREE(vuser->logon_script);
    98        
     98
     99        if (vuser->auth_ntlmssp_state) {
     100                auth_ntlmssp_end(&vuser->auth_ntlmssp_state);
     101        }
     102
    99103        session_yield(vuser);
    100104        SAFE_FREE(vuser->session_keystr);
     
    112116        SAFE_FREE(vuser->groups);
    113117        TALLOC_FREE(vuser->nt_user_token);
     118
     119        SAFE_FREE(vuser);
     120        num_validated_vuids--;
     121}
     122
     123void invalidate_intermediate_vuid(uint16 vuid)
     124{
     125        user_struct *vuser = get_partial_auth_user_struct(vuid);
     126
     127        if (vuser == NULL)
     128                return;
     129
     130        if (vuser->auth_ntlmssp_state) {
     131                auth_ntlmssp_end(&vuser->auth_ntlmssp_state);
     132        }
     133
     134        DLIST_REMOVE(validated_users, vuser);
    114135
    115136        SAFE_FREE(vuser);
     
    164185        if (num_validated_vuids >= 0xFFFF-VUID_OFFSET) {
    165186                data_blob_free(&session_key);
     187                TALLOC_FREE(server_info);
    166188                return UID_FIELD_INVALID;
    167189        }
     
    170192                DEBUG(0,("Failed to malloc users struct!\n"));
    171193                data_blob_free(&session_key);
     194                TALLOC_FREE(server_info);
    172195                return UID_FIELD_INVALID;
    173196        }
     
    176199
    177200        /* Allocate a free vuid. Yes this is a linear search... :-) */
    178         while( get_valid_user_struct(next_vuid) != NULL ) {
     201        while( (get_valid_user_struct(next_vuid) != NULL)
     202               || (get_partial_auth_user_struct(next_vuid) != NULL) ) {
    179203                next_vuid++;
    180204                /* Check for vuid wrap. */
  • branches/samba-3.0/source/smbd/posix_acls.c

    r105 r124  
    13371337                                psa1->flags |= (psa2->flags & (SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT));
    13381338                                psa2->flags &= ~(SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT);
    1339                                
     1339
    13401340                        } else if (psa2->flags & SEC_ACE_FLAG_INHERIT_ONLY) {
    13411341
    13421342                                psa2->flags |= (psa1->flags & (SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT));
    13431343                                psa1->flags &= ~(SEC_ACE_FLAG_CONTAINER_INHERIT|SEC_ACE_FLAG_OBJECT_INHERIT);
    1344                                
     1344
    13451345                        }
    13461346                }
     
    14031403                } else if (sid_to_uid( &current_ace->trustee, &current_ace->unix_ug.uid)) {
    14041404                        current_ace->owner_type = UID_ACE;
    1405                         current_ace->type = SMB_ACL_USER;
     1405                        /* If it's the owning user, this is a user_obj, not
     1406                         * a user. */
     1407                        if (current_ace->unix_ug.uid == pst->st_uid) {
     1408                                current_ace->type = SMB_ACL_USER_OBJ;
     1409                        } else {
     1410                                current_ace->type = SMB_ACL_USER;
     1411                        }
    14061412                } else if (sid_to_gid( &current_ace->trustee, &current_ace->unix_ug.gid)) {
    14071413                        current_ace->owner_type = GID_ACE;
    1408                         current_ace->type = SMB_ACL_GROUP;
     1414                        /* If it's the primary group, this is a group_obj, not
     1415                         * a group. */
     1416                        if (current_ace->unix_ug.gid == pst->st_gid) {
     1417                                current_ace->type = SMB_ACL_GROUP_OBJ;
     1418                        } else {
     1419                                current_ace->type = SMB_ACL_GROUP;
     1420                        }
    14091421                } else {
    14101422                        fstring str;
     
    31003112}
    31013113
    3102 static NTSTATUS append_ugw_ace(files_struct *fsp,
    3103                         SMB_STRUCT_STAT *psbuf,
    3104                         mode_t unx_mode,
    3105                         int ugw,
    3106                         SEC_ACE *se)
    3107 {
    3108         mode_t perms;
    3109         SEC_ACCESS acc;
    3110         int nt_acl_type; /* Tru64 has "acl_type" as a macro.. */
    3111         DOM_SID trustee;
    3112 
    3113         switch (ugw) {
    3114                 case S_IRUSR:
    3115                         perms = unix_perms_to_acl_perms(unx_mode,
    3116                                                         S_IRUSR,
    3117                                                         S_IWUSR,
    3118                                                         S_IXUSR);
    3119                         uid_to_sid(&trustee, psbuf->st_uid );
    3120                         break;
    3121                 case S_IRGRP:
    3122                         perms = unix_perms_to_acl_perms(unx_mode,
    3123                                                         S_IRGRP,
    3124                                                         S_IWGRP,
    3125                                                         S_IXGRP);
    3126                         gid_to_sid(&trustee, psbuf->st_gid );
    3127                         break;
    3128                 case S_IROTH:
    3129                         perms = unix_perms_to_acl_perms(unx_mode,
    3130                                                         S_IROTH,
    3131                                                         S_IWOTH,
    3132                                                         S_IXOTH);
    3133                         sid_copy(&trustee, &global_sid_World);
    3134                         break;
    3135                 default:
    3136                         return NT_STATUS_INVALID_PARAMETER;
    3137         }
    3138         acc = map_canon_ace_perms(SNUM(fsp->conn),
    3139                                 &nt_acl_type,
    3140                                 perms,
    3141                                 fsp->is_directory);
    3142 
    3143         init_sec_ace(se,
    3144                 &trustee,
    3145                 nt_acl_type,
    3146                 acc,
    3147                 0);
    3148         return NT_STATUS_OK;
    3149 }
    3150 
    3151 /****************************************************************************
    3152  If this is an
     3114/****************************************************************************
     3115 Take care of parent ACL inheritance.
    31533116****************************************************************************/
    31543117
     
    31693132        size_t sd_size;
    31703133        unsigned int i, j;
    3171         mode_t unx_mode;
     3134        BOOL is_dacl_protected = (psd->type & SE_DESC_DACL_PROTECTED);
    31723135
    31733136        ZERO_STRUCT(sbuf);
     
    31833146                return NT_STATUS_NO_MEMORY;
    31843147        }
    3185 
    3186         /* Create a default mode for u/g/w. */
    3187         unx_mode = unix_mode(fsp->conn,
    3188                         aARCH | (fsp->is_directory ? aDIR : 0),
    3189                         fsp->fsp_name,
    3190                         parent_name);
    31913148
    31923149        status = open_directory(fsp->conn,
     
    32143171        }
    32153172
    3216         /*
     3173        /*
    32173174         * Make room for potentially all the ACLs from
    3218          * the parent, plus the user/group/other triple.
     3175         * the parent. We used to add the ugw triple here,
     3176         * as we knew we were dealing with POSIX ACLs.
     3177         * We no longer need to do so as we can guarentee
     3178         * that a default ACL from the parent directory will
     3179         * be well formed for POSIX ACLs if it came from a
     3180         * POSIX ACL source, and if we're not writing to a
     3181         * POSIX ACL sink then we don't care if it's not well
     3182         * formed. JRA.
    32193183         */
    32203184
    3221         num_aces += parent_sd->dacl->num_aces + 3;
     3185        num_aces += parent_sd->dacl->num_aces;
    32223186
    32233187        if((new_ace = TALLOC_ZERO_ARRAY(mem_ctx, SEC_ACE,
     
    32253189                return NT_STATUS_NO_MEMORY;
    32263190        }
    3227 
    3228         DEBUG(10,("append_parent_acl: parent ACL has %u entries. New "
    3229                 "ACL has %u entries\n",
    3230                 parent_sd->dacl->num_aces, num_aces ));
    32313191
    32323192        /* Start by copying in all the given ACE entries. */
     
    32403200         */
    32413201
    3242          /*
    3243           * Append u/g/w.
    3244           */
    3245 
    3246         status = append_ugw_ace(fsp, psbuf, unx_mode, S_IRUSR, &new_ace[i++]);
    3247         if (!NT_STATUS_IS_OK(status)) {
    3248                 return status;
    3249         }
    3250         status = append_ugw_ace(fsp, psbuf, unx_mode, S_IRGRP, &new_ace[i++]);
    3251         if (!NT_STATUS_IS_OK(status)) {
    3252                 return status;
    3253         }
    3254         status = append_ugw_ace(fsp, psbuf, unx_mode, S_IROTH, &new_ace[i++]);
    3255         if (!NT_STATUS_IS_OK(status)) {
    3256                 return status;
    3257         }
    3258 
    32593202        /* Finally append any inherited ACEs. */
    32603203        for (j = 0; j < parent_sd->dacl->num_aces; j++) {
    32613204                SEC_ACE *se = &parent_sd->dacl->aces[j];
    3262                 uint32 i_flags = se->flags & (SEC_ACE_FLAG_OBJECT_INHERIT|
    3263                                         SEC_ACE_FLAG_CONTAINER_INHERIT|
    3264                                         SEC_ACE_FLAG_INHERIT_ONLY);
    32653205
    32663206                if (fsp->is_directory) {
    3267                         if (i_flags == SEC_ACE_FLAG_OBJECT_INHERIT) {
    3268                                 /* Should only apply to a file - ignore. */
     3207                        if (!(se->flags & SEC_ACE_FLAG_CONTAINER_INHERIT)) {
     3208                                /* Doesn't apply to a directory - ignore. */
     3209                                DEBUG(10,("append_parent_acl: directory %s "
     3210                                        "ignoring non container "
     3211                                        "inherit flags %u on ACE with sid %s "
     3212                                        "from parent %s\n",
     3213                                        fsp->fsp_name,
     3214                                        (unsigned int)se->flags,
     3215                                        sid_string_static(&se->trustee),
     3216                                        parent_name));
    32693217                                continue;
    32703218                        }
    32713219                } else {
    3272                         if ((i_flags & (SEC_ACE_FLAG_OBJECT_INHERIT|
    3273                                         SEC_ACE_FLAG_INHERIT_ONLY)) !=
    3274                                         SEC_ACE_FLAG_OBJECT_INHERIT) {
    3275                                 /* Should not apply to a file - ignore. */
     3220                        if (!(se->flags & SEC_ACE_FLAG_OBJECT_INHERIT)) {
     3221                                /* Doesn't apply to a file - ignore. */
     3222                                DEBUG(10,("append_parent_acl: file %s "
     3223                                        "ignoring non object "
     3224                                        "inherit flags %u on ACE with sid %s "
     3225                                        "from parent %s\n",
     3226                                        fsp->fsp_name,
     3227                                        (unsigned int)se->flags,
     3228                                        sid_string_static(&se->trustee),
     3229                                        parent_name));
    32763230                                continue;
    32773231                        }
    32783232                }
     3233
     3234                if (is_dacl_protected) {
     3235                        /* If the DACL is protected it means we must
     3236                         * not overwrite an existing ACE entry with the
     3237                         * same SID. This is order N^2. Ouch :-(. JRA. */
     3238                        unsigned int k;
     3239                        for (k = 0; k < psd->dacl->num_aces; k++) {
     3240                                if (sid_equal(&psd->dacl->aces[k].trustee,
     3241                                                &se->trustee)) {
     3242                                        break;
     3243                                }
     3244                        }
     3245                        if (k < psd->dacl->num_aces) {
     3246                                /* SID matched. Ignore. */
     3247                                DEBUG(10,("append_parent_acl: path %s "
     3248                                        "ignoring ACE with protected sid %s "
     3249                                        "from parent %s\n",
     3250                                        fsp->fsp_name,
     3251                                        sid_string_static(&se->trustee),
     3252                                        parent_name));
     3253                                continue;
     3254                        }
     3255                }
     3256
    32793257                sec_ace_copy(&new_ace[i], se);
    32803258                if (se->flags & SEC_ACE_FLAG_NO_PROPAGATE_INHERIT) {
     
    32823260                }
    32833261                new_ace[i].flags |= SEC_ACE_FLAG_INHERITED_ACE;
     3262
     3263                if (fsp->is_directory) {
     3264                        /*
     3265                         * Strip off any inherit only. It's applied.
     3266                         */
     3267                        new_ace[i].flags &= ~(SEC_ACE_FLAG_INHERIT_ONLY);
     3268                        if (se->flags & SEC_ACE_FLAG_NO_PROPAGATE_INHERIT) {
     3269                                /* No further inheritance. */
     3270                                new_ace[i].flags &=
     3271                                        ~(SEC_ACE_FLAG_CONTAINER_INHERIT|
     3272                                        SEC_ACE_FLAG_OBJECT_INHERIT);
     3273                        }
     3274                } else {
     3275                        /*
     3276                         * Strip off any container or inherit
     3277                         * flags, they can't apply to objects.
     3278                         */
     3279                        new_ace[i].flags &= ~(SEC_ACE_FLAG_CONTAINER_INHERIT|
     3280                                                SEC_ACE_FLAG_INHERIT_ONLY|
     3281                                                SEC_ACE_FLAG_NO_PROPAGATE_INHERIT);
     3282                }
     3283
    32843284                i++;
     3285
     3286                DEBUG(10,("append_parent_acl: path %s "
     3287                        "inheriting ACE with sid %s "
     3288                        "from parent %s\n",
     3289                        fsp->fsp_name,
     3290                        sid_string_static(&se->trustee),
     3291                        parent_name));
     3292
    32853293        }
    32863294
  • branches/samba-3.0/source/smbd/reply.c

    r105 r124  
    51715171                        status = check_name(conn, fname);
    51725172                        if (!NT_STATUS_IS_OK(status)) {
     5173                                CloseDir(dir_hnd);
    51735174                                return ERROR_NT(status);
    51745175                        }
     
    51765177                        status = check_name(conn, destname);
    51775178                        if (!NT_STATUS_IS_OK(status)) {
     5179                                CloseDir(dir_hnd);
    51785180                                return ERROR_NT(status);
    51795181                        }
  • branches/samba-3.0/source/smbd/server.c

    r71 r124  
    3131
    3232/* a useful macro to debug the last message processed */
    33 #define LAST_MESSAGE() smb_fn_name(last_message)
     33#define LAST_MESSAGE() (last_message != -1 ? smb_fn_name(last_message) : "")
    3434
    3535extern struct auth_context *negprot_global_auth_context;
  • branches/samba-3.0/source/smbd/sesssetup.c

    r105 r124  
    629629                auth_ntlmssp_end(auth_ntlmssp_state);
    630630                /* Kill the intermediate vuid */
    631                 invalidate_vuid(vuid);
     631                invalidate_intermediate_vuid(vuid);
    632632        }
    633633
     
    695695        if (!NT_STATUS_IS_OK(status)) {
    696696                /* Kill the intermediate vuid */
    697                 invalidate_vuid(vuid);
     697                invalidate_intermediate_vuid(vuid);
    698698                return ERROR_NT(nt_status_squash(status));
    699699        }
     
    709709                if (destroy_vuid) {
    710710                        /* Kill the intermediate vuid */
    711                         invalidate_vuid(vuid);
     711                        invalidate_intermediate_vuid(vuid);
    712712                }
    713713                return ret;
    714714        }
    715715#endif
     716
     717        if (got_kerberos_mechanism) {
     718                invalidate_intermediate_vuid(vuid);
     719                DEBUG(3,("reply_spnego_negotiate: network "
     720                        "misconfiguration, client sent us a "
     721                        "krb5 ticket and kerberos security "
     722                        "not enabled"));
     723                return ERROR_NT(nt_status_squash(NT_STATUS_LOGON_FAILURE));
     724        }
    716725
    717726        if (*auth_ntlmssp_state) {
     
    722731        if (!NT_STATUS_IS_OK(status)) {
    723732                /* Kill the intermediate vuid */
    724                 invalidate_vuid(vuid);
     733                invalidate_intermediate_vuid(vuid);
    725734                return ERROR_NT(nt_status_squash(status));
    726735        }
     
    760769#endif
    761770                /* Kill the intermediate vuid */
    762                 invalidate_vuid(vuid);
    763 
    764                 return ERROR_NT(nt_status_squash(NT_STATUS_INVALID_PARAMETER));
     771                invalidate_intermediate_vuid(vuid);
     772
     773                return ERROR_NT(nt_status_squash(NT_STATUS_LOGON_FAILURE));
    765774        }
    766775
     
    781790                                if (destroy_vuid) {
    782791                                        /* Kill the intermediate vuid */
    783                                         invalidate_vuid(vuid);
     792                                        invalidate_intermediate_vuid(vuid);
    784793                                }
    785794                                return ret;
     
    791800        /* If we get here it wasn't a negTokenTarg auth packet. */
    792801        data_blob_free(&secblob);
    793        
     802
    794803        if (!*auth_ntlmssp_state) {
    795804                /* Kill the intermediate vuid */
    796                 invalidate_vuid(vuid);
     805                invalidate_intermediate_vuid(vuid);
    797806
    798807                /* auth before negotiatiate? */
    799                 return ERROR_NT(nt_status_squash(NT_STATUS_INVALID_PARAMETER));
    800         }
    801        
    802         status = auth_ntlmssp_update(*auth_ntlmssp_state, 
     808                return ERROR_NT(NT_STATUS_LOGON_FAILURE);
     809        }
     810
     811        status = auth_ntlmssp_update(*auth_ntlmssp_state,
    803812                                        auth, &auth_reply);
    804813
    805814        data_blob_free(&auth);
    806815
    807         reply_spnego_ntlmssp(conn, inbuf, outbuf, vuid, 
     816        reply_spnego_ntlmssp(conn, inbuf, outbuf, vuid,
    808817                             auth_ntlmssp_state,
    809818                             &auth_reply, status, True);
    810                
     819
    811820        data_blob_free(&auth_reply);
    812821
     
    11171126                if (!NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
    11181127                        /* Real error - kill the intermediate vuid */
    1119                         invalidate_vuid(vuid);
     1128                        invalidate_intermediate_vuid(vuid);
    11201129                }
    11211130                data_blob_free(&blob1);
     
    11451154                        if (!NT_STATUS_IS_OK(status)) {
    11461155                                /* Kill the intermediate vuid */
    1147                                 invalidate_vuid(vuid);
     1156                                invalidate_intermediate_vuid(vuid);
    11481157                                data_blob_free(&blob1);
    11491158                                return ERROR_NT(nt_status_squash(status));
  • branches/samba-3.0/source/smbd/trans2.c

    r105 r124  
    22342234}
    22352235
     2236static void samba_extended_info_version(struct smb_extended_info *extended_info)
     2237{
     2238                                SMB_ASSERT(extended_info != NULL);
     2239
     2240                                extended_info->samba_magic = SAMBA_EXTENDED_INFO_MAGIC;
     2241                                extended_info->samba_version = ((SAMBA_VERSION_MAJOR & 0xff) << 24)
     2242                                                                                                                                                         | ((SAMBA_VERSION_MINOR & 0xff) << 16)
     2243                                                                                                                                                         | ((SAMBA_VERSION_RELEASE & 0xff) << 8);
     2244#ifdef SAMBA_VERSION_REVISION
     2245                                extended_info->samba_version |= (tolower(*SAMBA_VERSION_REVISION) - 'a' + 1) & 0xff;
     2246#endif
     2247                                extended_info->samba_subversion = 0;
     2248#ifdef SAMBA_VERSION_RC_RELEASE
     2249                                extended_info->samba_subversion |= (SAMBA_VERSION_RC_RELEASE & 0xff) << 24;
     2250#else
     2251#ifdef SAMBA_VERSION_PRE_RELEASE
     2252                                extended_info->samba_subversion |= (SAMBA_VERSION_PRE_RELEASE & 0xff) << 16;
     2253#endif
     2254#endif
     2255#ifdef SAMBA_VERSION_VENDOR_PATCH
     2256                                extended_info->samba_subversion |= (SAMBA_VERSION_VENDOR_PATCH & 0xffff);
     2257#endif
     2258                                extended_info->samba_subversion = 0;
     2259#ifdef SAMBA_VERSION_GIT_COMMIT_TIME
     2260                                unix_to_nt_time(&extended_info->samba_gitcommitdate, SAMBA_VERSION_GIT_COMMIT_TIME);
     2261#endif
     2262
     2263                                memset(extended_info->samba_version_string, 0,
     2264                                                         sizeof(extended_info->samba_version_string));
     2265
     2266                                snprintf (extended_info->samba_version_string,
     2267                                                                        sizeof(extended_info->samba_version_string),
     2268                                                                        "%s", samba_version_string());
     2269}
     2270
    22362271/****************************************************************************
    22372272 Reply to a TRANS2_QFSINFO (query filesystem info).
     
    23412376                        SIVAL(pdata,0,FILE_CASE_PRESERVED_NAMES|FILE_CASE_SENSITIVE_SEARCH|
    23422377                                (lp_nt_acl_support(SNUM(conn)) ? FILE_PERSISTENT_ACLS : 0)|
     2378                                FILE_UNICODE_ON_DISK|
    23432379                                quota_flag); /* FS ATTRIBUTES */
    23442380
     
    25222558#endif /* HAVE_SYS_QUOTAS */
    25232559                case SMB_FS_OBJECTID_INFORMATION:
     2560                {
     2561                        /*
     2562                         * No object id, but we transmit version information.
     2563                         */
     2564                        struct smb_extended_info extended_info;
     2565                        samba_extended_info_version (&extended_info);
     2566                        SIVAL(pdata,16,extended_info.samba_magic);
     2567                        SIVAL(pdata,20,extended_info.samba_version);
     2568                        SIVAL(pdata,24,extended_info.samba_subversion);
     2569                        SBIG_UINT(pdata,28,extended_info.samba_gitcommitdate);
     2570                        memcpy(pdata+36,extended_info.samba_version_string,28);
    25242571                        data_len = 64;
    25252572                        break;
     2573                }
    25262574
    25272575                /*
     
    33103358        }
    33113359
    3312         nlink = sbuf.st_nlink;
    3313 
    3314         if ((nlink > 0) && S_ISDIR(sbuf.st_mode)) {
    3315                 /* NTFS does not seem to count ".." */
    3316                 nlink -= 1;
    3317         }
    3318 
    3319         if ((nlink > 0) && delete_pending) {
    3320                 nlink -= 1;
    3321         }
    3322 
    33233360        if (INFO_LEVEL_IS_UNIX(info_level) && !lp_unix_extensions()) {
    33243361                return ERROR_NT(NT_STATUS_INVALID_LEVEL);
     
    33373374        if (!mode)
    33383375                mode = FILE_ATTRIBUTE_NORMAL;
     3376
     3377        nlink = sbuf.st_nlink;
     3378
     3379        if (nlink && (mode&aDIR)) {
     3380                nlink = 1;
     3381        }
     3382
     3383        if ((nlink > 0) && delete_pending) {
     3384                nlink -= 1;
     3385        }
    33393386
    33403387        fullpathname = fname;
Note: See TracChangeset for help on using the changeset viewer.