Ignore:
Timestamp:
Apr 9, 2010, 3:20:58 PM (15 years ago)
Author:
Silvan Scherrer
Message:

Samba 3.5.x: update to 3.5.2

Location:
vendor/current/source3/smbd
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/smbd/blocking.c

    r414 r427  
    7373        struct blocking_lock_record *blr;
    7474        struct timeval next_timeout;
     75        int max_brl_timeout = lp_parm_int(-1, "brl", "recalctime", 5);
    7576
    7677        TALLOC_FREE(brl_timeout);
     
    99100                DEBUG(10, ("Next timeout = Infinite.\n"));
    100101                return True;
     102        }
     103
     104        /*
     105         to account for unclean shutdowns by clients we need a
     106         maximum timeout that we use for checking pending locks. If
     107         we have any pending locks at all, then check if the pending
     108         lock can continue at least every brl:recalctime seconds
     109         (default 5 seconds).
     110
     111         This saves us needing to do a message_send_all() in the
     112         SIGCHLD handler in the parent daemon. That
     113         message_send_all() caused O(n^2) work to be done when IP
     114         failovers happened in clustered Samba, which could make the
     115         entire system unusable for many minutes.
     116        */
     117
     118        if (max_brl_timeout > 0) {
     119                struct timeval min_to = timeval_current_ofs(max_brl_timeout, 0);
     120                next_timeout = timeval_min(&next_timeout, &min_to);             
    101121        }
    102122
  • vendor/current/source3/smbd/posix_acls.c

    r414 r427  
    26992699
    27002700        /* Use the psbuf that was passed in. */
    2701         fsp->fsp_name->st = *psbuf;
     2701        if (psbuf != &fsp->fsp_name->st) {
     2702                fsp->fsp_name->st = *psbuf;
     2703        }
    27022704
    27032705#if defined(POSIX_ACL_NEEDS_MASK)
  • vendor/current/source3/smbd/process.c

    r414 r427  
    18131813
    18141814        if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
     1815                if (req->chain_outbuf == NULL) {
     1816                        req->chain_outbuf = TALLOC_REALLOC_ARRAY(
     1817                                req, req->outbuf, uint8_t,
     1818                                smb_len(req->outbuf) + 4);
     1819                        if (req->chain_outbuf == NULL) {
     1820                                smb_panic("talloc failed");
     1821                        }
     1822                }
     1823                req->outbuf = NULL;
    18151824                goto error;
    18161825        }
     
    18401849                        req, req->outbuf, uint8_t, smb_len(req->outbuf) + 4);
    18411850                if (req->chain_outbuf == NULL) {
    1842                         goto error;
     1851                        smb_panic("talloc failed");
    18431852                }
    18441853                req->outbuf = NULL;
  • vendor/current/source3/smbd/reply.c

    r414 r427  
    23972397                ret = SMB_VFS_LSTAT(conn, smb_fname);
    23982398        } else {
    2399                 ret = SMB_VFS_LSTAT(conn, smb_fname);
     2399                ret = SMB_VFS_STAT(conn, smb_fname);
    24002400        }
    24012401        if (ret != 0) {
     
    58475847                          smb_fname_str_dbg(smb_fname_dst)));
    58485848
     5849                if (lp_map_archive(SNUM(conn)) ||
     5850                    lp_store_dos_attributes(SNUM(conn))) {
     5851                        /* We must set the archive bit on the newly
     5852                           renamed file. */
     5853                        if (SMB_VFS_STAT(conn, smb_fname_dst) == 0) {
     5854                                uint32_t old_dosmode = dos_mode(conn,
     5855                                                        smb_fname_dst);
     5856                                file_set_dosmode(conn,
     5857                                        smb_fname_dst,
     5858                                        old_dosmode | FILE_ATTRIBUTE_ARCHIVE,
     5859                                        NULL,
     5860                                        true);
     5861                        }
     5862                }
     5863
    58495864                notify_rename(conn, fsp->is_directory, fsp->fsp_name,
    58505865                              smb_fname_dst);
  • vendor/current/source3/smbd/server.c

    r414 r427  
    220220}
    221221
     222/*
     223  at most every smbd:cleanuptime seconds (default 20), we scan the BRL
     224  and locking database for entries to cleanup. As a side effect this
     225  also cleans up dead entries in the connections database (due to the
     226  traversal in message_send_all()
     227
     228  Using a timer for this prevents a flood of traversals when a large
     229  number of clients disconnect at the same time (perhaps due to a
     230  network outage). 
     231*/
     232
     233static void cleanup_timeout_fn(struct event_context *event_ctx,
     234                                struct timed_event *te,
     235                                struct timeval now,
     236                                void *private_data)
     237{
     238        struct timed_event **cleanup_te = (struct timed_event **)private_data;
     239
     240        DEBUG(1,("Cleaning up brl and lock database after unclean shutdown\n"));
     241        message_send_all(smbd_messaging_context(), MSG_SMB_UNLOCK, NULL, 0, NULL);
     242        messaging_send_buf(smbd_messaging_context(), procid_self(),
     243                                MSG_SMB_BRL_VALIDATE, NULL, 0);
     244        /* mark the cleanup as having been done */
     245        (*cleanup_te) = NULL;
     246}
     247
    222248static void remove_child_pid(pid_t pid, bool unclean_shutdown)
    223249{
    224250        struct child_pid *child;
     251        static struct timed_event *cleanup_te;
    225252
    226253        if (unclean_shutdown) {
    227                 /* a child terminated uncleanly so tickle all processes to see
    228                    if they can grab any of the pending locks
    229                 */
    230                 DEBUG(3,(__location__ " Unclean shutdown of pid %u\n", (unsigned int)pid));
    231                 messaging_send_buf(smbd_messaging_context(), procid_self(),
    232                                    MSG_SMB_BRL_VALIDATE, NULL, 0);
    233                 message_send_all(smbd_messaging_context(),
    234                                  MSG_SMB_UNLOCK, NULL, 0, NULL);
     254                /* a child terminated uncleanly so tickle all
     255                   processes to see if they can grab any of the
     256                   pending locks
     257                */
     258                DEBUG(3,(__location__ " Unclean shutdown of pid %u\n",
     259                        (unsigned int)pid));
     260                if (!cleanup_te) {
     261                        /* call the cleanup timer, but not too often */
     262                        int cleanup_time = lp_parm_int(-1, "smbd", "cleanuptime", 20);
     263                        cleanup_te = event_add_timed(smbd_event_context(), NULL,
     264                                                timeval_current_ofs(cleanup_time, 0),
     265                                                cleanup_timeout_fn,
     266                                                &cleanup_te);
     267                        DEBUG(1,("Scheduled cleanup of brl and lock database after unclean shutdown\n"));
     268                }
    235269        }
    236270
     
    10481082        gain_root_group_privilege();
    10491083
    1050         /*
    1051          * Ensure we have CAP_KILL capability set on Linux,
    1052          * where we need this to communicate with threads.
    1053          * This is inherited by new threads, but not by new
    1054          * processes across exec().
    1055          */
    1056         set_effective_capability(KILL_CAPABILITY);
    1057 
    10581084        fault_setup((void (*)(void *))exit_server_fault);
    10591085        dump_core_setup("smbd");
     
    12811307
    12821308        TALLOC_FREE(frame);
     1309        /* make sure we always have a valid stackframe */
     1310        frame = talloc_stackframe();
    12831311
    12841312        smbd_parent_loop(parent);
    12851313
    12861314        exit_server_cleanly(NULL);
     1315        TALLOC_FREE(frame);
    12871316        return(0);
    12881317}
  • vendor/current/source3/smbd/service.c

    r414 r427  
    340340                        iPrinterService = load_registry_service(PRINTERS_NAME);
    341341                }
    342                 if (iPrinterService) {
     342                if (iPrinterService >= 0) {
    343343                        DEBUG(3,("checking whether %s is a valid printer name...\n", service));
    344344                        if (pcap_printername_ok(service)) {
  • vendor/current/source3/smbd/sesssetup.c

    r414 r427  
    12141214#endif
    12151215
    1216         p2 = (char *)req->buf + data_blob_len;
     1216        p2 = (char *)req->buf + blob1.length;
    12171217
    12181218        p2 += srvstr_pull_req_talloc(talloc_tos(), req, &tmp, p2,
Note: See TracChangeset for help on using the changeset viewer.