Ignore:
Timestamp:
Mar 11, 2009, 9:14:55 AM (16 years ago)
Author:
Paul Smedley
Message:

Add 'missing' 3.0.34 diffs

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

Legend:

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

    r44 r165  
    254254        a->aio_sigevent.sigev_value.sival_int = aio_ex->mid;
    255255
     256        become_root();
    256257        if (SMB_VFS_AIO_READ(fsp,a) == -1) {
    257258                DEBUG(0,("schedule_aio_read_and_X: aio_read failed. "
    258259                         "Error %s\n", strerror(errno) ));
    259260                delete_aio_ex(aio_ex);
    260                 return False;
    261         }
     261                unbecome_root();
     262                return False;
     263        }
     264        unbecome_root();
    262265
    263266        DEBUG(10,("schedule_aio_read_and_X: scheduled aio_read for file %s, "
     
    344347        a->aio_sigevent.sigev_value.sival_int = aio_ex->mid;
    345348
     349        become_root();
    346350        if (SMB_VFS_AIO_WRITE(fsp,a) == -1) {
    347351                DEBUG(3,("schedule_aio_wrote_and_X: aio_write failed. "
    348352                         "Error %s\n", strerror(errno) ));
    349353                delete_aio_ex(aio_ex);
    350                 return False;
    351         }
     354                unbecome_root();
     355                return False;
     356        }
     357        unbecome_root();
    352358
    353359        if (!write_through && !lp_syncalways(SNUM(fsp->conn))
  • branches/samba-3.0/source/smbd/build_options.c

    r124 r165  
    345345        output(screen, "   HAVE_INTTYPES_H\n");
    346346#endif
     347#ifdef HAVE_KEYUTILS_H
     348        output(screen, "   HAVE_KEYUTILS_H\n");
     349#endif
    347350#ifdef HAVE_KRB5_H
    348351        output(screen, "   HAVE_KRB5_H\n");
     
    22652268        output(screen, "   WITH_CIFSMOUNT\n");
    22662269#endif
     2270#ifdef WITH_CIFSUPCALL
     2271        output(screen, "   WITH_CIFSUPCALL\n");
     2272#endif
    22672273#ifdef WITH_DFS
    22682274        output(screen, "   WITH_DFS\n");
     
    26132619#ifdef WITH_CIFSMOUNT
    26142620        output(screen, "   WITH_CIFSMOUNT\n");
     2621#endif
     2622#ifdef WITH_CIFSUPCALL
     2623        output(screen, "   WITH_CIFSUPCALL\n");
    26152624#endif
    26162625#ifdef WITH_DFS
  • branches/samba-3.0/source/smbd/conn.c

    r134 r165  
    262262        handle = conn->vfs_handles;
    263263        while(handle) {
     264                thandle = handle->next;
    264265                DLIST_REMOVE(conn->vfs_handles, handle);
    265                 thandle = handle->next;
    266266                if (handle->free_data)
    267267                        handle->free_data(&handle->data);
  • branches/samba-3.0/source/smbd/dosmode.c

    r124 r165  
    7878        mode_t dir_mode = 0; /* Mode of the inherit_from directory if
    7979                              * inheriting. */
     80
    8081        if (!lp_store_dos_attributes(SNUM(conn)) && IS_DOS_READONLY(dosmode)) {
    8182                result &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
     
    167168                }
    168169        } /* Else never set the readonly bit. */
     170
    169171#ifndef __OS2__
    170172        if (MAP_ARCHIVE(conn) && ((sbuf->st_mode & S_IXUSR) != 0))
  • branches/samba-3.0/source/smbd/files.c

    r44 r165  
    125125        chain_fsp = fsp;
    126126
    127         /* A new fsp invalidates a negative fsp_fi_cache. */
    128         if (fsp_fi_cache.fsp == NULL) {
    129                 ZERO_STRUCT(fsp_fi_cache);
    130         }
     127        /* A new fsp invalidates the positive and
     128           negative fsp_fi_cache as the new fsp is pushed
     129           at the start of the list and we search from
     130           a cache hit to the *end* of the list. */
     131
     132        ZERO_STRUCT(fsp_fi_cache);
    131133
    132134        *result = fsp;
  • branches/samba-3.0/source/smbd/msdfs.c

    r134 r165  
    714714                                char **ppdata,
    715715                                struct junction_map *junction,
    716                                 int consumedcnt,
    717716                                BOOL self_referral)
    718717{
     
    771770
    772771        /* create the header */
    773         SSVAL(pdata,0,consumedcnt * 2); /* path consumed */
     772        SSVAL(pdata,0,requestedpathlen - 2); /* UCS2 of path consumed minus
     773
    774774        SSVAL(pdata,2,junction->referral_count); /* number of referral in this pkt */
    775775        if(self_referral) {
     
    815815                                char **ppdata,
    816816                                struct junction_map *junction,
    817                                 int consumedcnt,
    818817                                BOOL self_referral)
    819818{
     
    853852
    854853        /* create the header */
    855         SSVAL(pdata,0,consumedcnt * 2); /* path consumed */
     854        SSVAL(pdata,0,reqpathlen - 2); /* UCS2 of path consumed minus
     855                                          2 byte null */
     856
    856857        SSVAL(pdata,2,junction->referral_count); /* number of referral */
    857858        if(self_referral) {
     
    975976        case 2:
    976977                reply_size = setup_ver2_dfs_referral(pathnamep, ppdata, &junction,
    977                                                      consumedcnt, self_referral);
     978                                                     self_referral);
    978979                break;
    979980        case 3:
    980981                reply_size = setup_ver3_dfs_referral(pathnamep, ppdata, &junction,
    981                                                      consumedcnt, self_referral);
     982                                                     self_referral);
    982983                break;
    983984        default:
  • branches/samba-3.0/source/smbd/notify.c

    r124 r165  
    349349{
    350350        char *fullpath;
     351
     352        if (path[0] == '.' && path[1] == '/') {
     353                path += 2;
     354        }
    351355
    352356        if (asprintf(&fullpath, "%s/%s", conn->connectpath, path) == -1) {
  • branches/samba-3.0/source/smbd/password.c

    r124 r165  
    271271                        const char *unix_homedir =
    272272                                pdb_get_unix_homedir(server_info->sam_account);
    273 
    274273                        if (unix_homedir) {
    275274                                vuser->unix_homedir =
     
    356355                                        vuser->unix_homedir[1] = ':';
    357356#endif
    358 
    359357
    360358        if ( (!vuser->guest) && vuser->unix_homedir && *(vuser->unix_homedir))
  • branches/samba-3.0/source/smbd/posix_acls.c

    r140 r165  
    31203120}
    31213121
     3122#if 0
     3123/* Disable this - prevents ACL inheritance from the ACL editor. JRA. */
     3124
    31223125/****************************************************************************
    31233126 Take care of parent ACL inheritance.
     
    33013304        }
    33023305
    3303         parent_sd->dacl->aces = new_ace;
    3304         parent_sd->dacl->num_aces = i;
    3305 
    3306         *pp_new_sd = parent_sd;
     3306        /* This sucks. psd should be const and we should
     3307         * be doing a deep-copy here. We're getting away
     3308         * with is as we know parent_sd is talloced off
     3309         * talloc_tos() as well as psd. JRA. */
     3310
     3311        psd->dacl->aces = new_ace;
     3312        psd->dacl->num_aces = i;
     3313        psd->type &= ~(SE_DESC_DACL_AUTO_INHERITED|
     3314                         SE_DESC_DACL_AUTO_INHERIT_REQ);
     3315
     3316        *pp_new_sd = psd;
    33073317        return status;
    33083318}
     3319#endif
    33093320
    33103321/****************************************************************************
     
    34203431        create_file_sids(&sbuf, &file_owner_sid, &file_grp_sid);
    34213432
     3433#if 0
     3434        /* Disable this - prevents ACL inheritance from the ACL editor. JRA. */
     3435
     3436        /* See here: http://www.codeproject.com/KB/winsdk/accessctrl2.aspx
     3437         * for details and also the log trace in bug #4308. JRA.
     3438        */
     3439
    34223440        if ((security_info_sent & DACL_SECURITY_INFORMATION) &&
    34233441                psd->dacl != NULL &&
     
    34313449                }
    34323450        }
     3451#endif
    34333452
    34343453        acl_perms = unpack_canon_ace( fsp, &sbuf, &file_owner_sid, &file_grp_sid,
     
    42714290                return False;
    42724291        }
     4292#ifndef __OS2__
     4293        /* Samba always runs as root on OS/2 */
    42734294        if (current_user.ut.uid == 0 || conn->admin_user) {
    42744295                /* I'm sorry sir, I didn't know you were root... */
    42754296                return True;
    42764297        }
     4298#endif
    42774299
    42784300        /* Check primary owner write access. */
     
    43274349                (unsigned int)access_mask, fname ));
    43284350
    4329 #ifndef __OS2__
    4330         /* Samba always runs as root on OS/2 */
    43314351        if (current_user.ut.uid == 0 || conn->admin_user) {
    43324352                /* I'm sorry sir, I didn't know you were root... */
    43334353                return True;
    43344354        }
    4335 #endif
     4355
    43364356        if (!VALID_STAT(*psbuf)) {
    43374357                /* Get the file permission mask and owners. */
  • branches/samba-3.0/source/smbd/process.c

    r135 r165  
    968968
    969969                        if (!change_to_user(conn,session_tag)) {
     970                                remove_deferred_open_smb_message(
     971                                        SVAL(inbuf, smb_mid));
    970972                                return(ERROR_NT(NT_STATUS_DOS(ERRSRV,ERRbaduid)));
    971973                        }
  • branches/samba-3.0/source/smbd/reply.c

    r134 r165  
    169169
    170170        *d = '\0';
    171 
    172171        return ret;
    173172}
     
    22152214
    22162215                if ( SMB_VFS_SENDFILE( smbd_server_fd(), fsp, fsp->fh->fd, &header, startpos, nread) == -1) {
    2217                         /* Returning ENOSYS means no data at all was sent. Do this as a normal read. */
     2216                        /* Returning ENOSYS means no data at all was sent.
     2217                           Do this as a normal read. */
    22182218                        if (errno == ENOSYS) {
    22192219                                goto normal_readbraw;
     
    46454645                        DEBUG(3,("rename_internals: succeeded doing rename "
    46464646                                 "on %s -> %s\n", directory, newname));
     4647                        notify_rename(conn, S_ISDIR(sbuf1.st_mode),
     4648                                      directory, newname);
    46474649                        rename_open_files(conn, lck, sbuf1.st_dev,
    46484650                                          sbuf1.st_ino, newname);
    46494651                        TALLOC_FREE(lck);
    4650                         notify_rename(conn, S_ISDIR(sbuf1.st_mode),
    4651                                       directory, newname);
    46524652                        return NT_STATUS_OK;   
    46534653                }
  • branches/samba-3.0/source/smbd/server.c

    r124 r165  
    300300 Open the socket communication.
    301301****************************************************************************/
     302
     303bool reinit_after_fork(struct messaging_context *msg_ctx,
     304                        struct event_context *ev_ctx,
     305                        bool parent_longlived);
    302306
    303307static BOOL open_sockets_smbd(BOOL is_daemon, BOOL interactive, const char *smb_ports)
     
    561565                                                        False);
    562566                               
    563                                 /* Reset the state of the random
    564                                  * number generation system, so
    565                                  * children do not get the same random
    566                                  * numbers as each other */
    567 
    568                                 set_need_random_reseed();
    569                                 /* tdb needs special fork handling - remove
    570                                  * CLEAR_IF_FIRST flags */
    571                                 if (tdb_reopen_all(1) == -1) {
    572                                         DEBUG(0,("tdb_reopen_all failed.\n"));
    573                                         smb_panic("tdb_reopen_all failed.");
     567                                if (!reinit_after_fork(smbd_messaging_context(),
     568                                                       smbd_event_context(),
     569                                                       true)) {
     570                                        DEBUG(0, ("reinit_after_fork failed.\n"));
     571                                        smb_panic("reinit_after_fork failed.\n");
    574572                                }
    575573
    576574                                return True;
    577575                        }
     576                        /* The parent doesn't need this socket */
     577                        close(smbd_server_fd());
    578578
    579579                        /* Sun May 6 18:56:14 2001 ackley@cs.unm.edu:
     
    946946
    947947        reopen_logs();
     948
    948949#ifdef __OS2__
    949950        unsigned long  _System DosSetPriority (unsigned long  ulScope, unsigned long  ulClass, long lDelta, unsigned long ulID);
     
    956957        DEBUG(0,( "Server priority set to PRTYC_FOREGROUNDSERVER\n"));
    957958#endif
     959
    958960        DEBUG(0,( "smbd version %s started.\n", SAMBA_VERSION_STRING));
    959961        DEBUGADD( 0, ( "%s\n", COPYRIGHT_STARTUP_MESSAGE ) );
  • branches/samba-3.0/source/smbd/sesssetup.c

    r158 r165  
    9999/****************************************************************************
    100100 Send a security blob via a session setup reply.
     101 We must already have called set_message(outbuf,4,0,True)
     102 before calling this function.
    101103****************************************************************************/
    102104
     
    109111                ERROR_NT(nt_status_squash(nt_status));
    110112        } else {
    111                 set_message(outbuf,4,0,True);
    112 
    113113                nt_status = nt_status_squash(nt_status);
    114114                SIVAL(outbuf, smb_rcls, NT_STATUS_V(nt_status));
     
    519519        SAFE_FREE(client);
    520520
     521        set_message(outbuf,4,0,True);
     522
    521523        if (sess_vuid == UID_FIELD_INVALID ) {
    522524                ret = NT_STATUS_LOGON_FAILURE;
     
    525527                reload_services( True );
    526528
    527                 set_message(outbuf,4,0,True);
    528529                SSVAL(outbuf, smb_vwv3, 0);
    529530                       
     
    582583        }
    583584
     585        set_message(outbuf,4,0,True);
     586
    584587        if (NT_STATUS_IS_OK(nt_status)) {
    585588                int sess_vuid;
     
    598601                        reload_services( True );
    599602
    600                         set_message(outbuf,4,0,True);
    601603                        SSVAL(outbuf, smb_vwv3, 0);
    602604                       
  • branches/samba-3.0/source/smbd/share_access.c

    r1 r165  
    193193 */
    194194
    195 BOOL user_ok_token(const char *username, struct nt_user_token *token, int snum)
     195BOOL user_ok_token(const char *username, const struct nt_user_token *token, int snum)
    196196{
    197197        if (lp_invalid_users(snum) != NULL) {
     
    250250
    251251BOOL is_share_read_only_for_token(const char *username,
    252                                   struct nt_user_token *token, int snum)
     252                                  const struct nt_user_token *token, int snum)
    253253{
    254254        BOOL result = lp_readonly(snum);
  • branches/samba-3.0/source/smbd/trans2.c

    r159 r165  
    205205        }
    206206
    207         if (sizeret == -1){
    208                 return NULL;}
     207        if (sizeret == -1)
     208                return NULL;
    209209
    210210        DEBUG(10,("get_ea_list_from_file: ea_namelist size = %u\n", (unsigned int)sizeret ));
     
    303303        size_t total_ea_len = 0;
    304304        TALLOC_CTX *mem_ctx = NULL;
     305
    305306        if (!lp_ea_support(SNUM(conn))) {
    306307                return 0;
     
    865866                        return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
    866867                }
    867         } else if (IVAL(pdata,0) != 4) {
    868                 return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
    869868        }
    870869
     
    977976        if (mask[0] == '.' && mask[1] == 0)
    978977                return False;
     978        if (dptr_has_wild(conn->dirptr)) {
     979                return False;
     980        }
    979981        if (conn->case_sensitive)
    980982                return strcmp(str,mask)==0;
    981         if (StrCaseCmp(str,mask) != 0) {
    982                 return False;
    983         }
    984         if (dptr_has_wild(conn->dirptr)) {
    985                 return False;
    986         }
    987         return True;
     983        else
     984                return StrCaseCmp(str,mask) == 0;
    988985}
    989986
     
    41624159                        fsp_set_pending_modtime(fsp, ts[1]);
    41634160                }
     4161
    41644162        }
    41654163#ifdef __OS2__
     
    61906188                return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
    61916189        }
     6190        /* If total_data == 4 Windows doesn't care what values
     6191         * are placed in that field, it just ignores them.
     6192         * The System i QNTC IBM SMB client puts bad values here,
     6193         * so ignore them. */
    61926194
    61936195        status = create_directory(conn, directory);
  • branches/samba-3.0/source/smbd/uid.c

    r106 r165  
    143143}
    144144
     145/*******************************************************************
     146 Check if a username is OK in share level security.
     147********************************************************************/
     148
     149static bool check_user_ok_sharelevel_security(connection_struct *conn,
     150                                        const char *unix_name,
     151                                        int snum)
     152{
     153        NT_USER_TOKEN *token = conn->nt_user_token;
     154
     155        if (!user_ok_token(unix_name, token, snum)) {
     156                return false;
     157        }
     158
     159        conn->read_only = is_share_read_only_for_token(unix_name,
     160                                                      token,
     161                                                      snum);
     162
     163        if (!conn->read_only &&
     164            !share_access_check(token, lp_servicename(snum),
     165                                FILE_WRITE_DATA)) {
     166                /* smb.conf allows r/w, but the security descriptor denies
     167                 * write. Fall back to looking at readonly. */
     168                conn->read_only = true;
     169                DEBUG(5,("falling back to read-only access-evaluation due to "
     170                         "security descriptor\n"));
     171        }
     172
     173        if (!share_access_check(token, lp_servicename(snum),
     174                                conn->read_only ?
     175                                FILE_READ_DATA : FILE_WRITE_DATA)) {
     176                return false;
     177        }
     178
     179        conn->admin_user = token_contains_name_in_list(
     180                                unix_name, NULL, token,
     181                                lp_admin_users(SNUM(conn)));
     182
     183        return true;
     184}
     185
     186
    145187/****************************************************************************
    146188 Become the user of a connection number without changing the security context
     
    150192BOOL change_to_user(connection_struct *conn, uint16 vuid)
    151193{
     194        enum security_types sec = (enum security_types)lp_security();
    152195        user_struct *vuser = get_valid_user_struct(vuid);
    153 
    154196        int snum;
    155197        gid_t gid;
     
    173215         */
    174216
    175         if((lp_security() == SEC_SHARE) && (current_user.conn == conn) &&
     217        if((sec == SEC_SHARE) && (current_user.conn == conn) &&
    176218           (current_user.ut.uid == conn->uid)) {
    177219                DEBUG(4,("change_to_user: Skipping user change - already "
     
    194236                         lp_servicename(snum)));
    195237                return False;
     238        } else if ((sec == SEC_SHARE) && !check_user_ok_sharelevel_security(conn,
     239                        conn->user, snum)) {
     240                DEBUG(2,("change_to_user: unix user %s "
     241                         "not permitted access to share %s.\n",
     242                         conn->user,
     243                         lp_servicename(snum)));
     244                return false;
    196245        }
    197246
     
    273322        DEBUG(5,("change_to_user uid=(%d,%d) gid=(%d,%d)\n",
    274323                 (int)getuid(),(int)geteuid(),(int)getgid(),(int)getegid()));
    275 
     324 
    276325        return(True);
    277326}
Note: See TracChangeset for help on using the changeset viewer.