Ignore:
Timestamp:
Nov 27, 2012, 4:56:06 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated vendor to 3.6.9

File:
1 edited

Legend:

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

    r740 r746  
    6565         */
    6666
     67        if (sconn->client_id.name != NULL &&
     68            sconn->client_id.name != sconn->client_id.addr) {
     69                talloc_free(discard_const_p(char, sconn->client_id.name));
     70                sconn->client_id.name = NULL;
     71        }
     72
    6773        client_addr(fd, sconn->client_id.addr, sizeof(sconn->client_id.addr));
    6874
     
    277283        static struct timed_event *cleanup_te;
    278284        struct server_id child_id;
     285
     286        child_id = procid_self(); /* Just initialize pid and potentially vnn */
     287        child_id.pid = pid;
     288
     289        for (child = children; child != NULL; child = child->next) {
     290                if (child->pid == pid) {
     291                        struct child_pid *tmp = child;
     292                        DLIST_REMOVE(children, child);
     293                        SAFE_FREE(tmp);
     294                        num_children -= 1;
     295                        break;
     296                }
     297        }
     298
     299        if (child == NULL) {
     300                /* not all forked child processes are added to the children list */
     301                DEBUG(2, ("Could not find child %d -- ignoring\n", (int)pid));
     302                return;
     303        }
    279304
    280305        if (unclean_shutdown) {
     
    296321        }
    297322
    298         child_id = procid_self(); /* Just initialize pid and potentially vnn */
    299         child_id.pid = pid;
    300 
    301323        if (!serverid_deregister(child_id)) {
    302324                DEBUG(1, ("Could not remove pid %d from serverid.tdb\n",
    303325                          (int)pid));
    304326        }
    305 
    306         for (child = children; child != NULL; child = child->next) {
    307                 if (child->pid == pid) {
    308                         struct child_pid *tmp = child;
    309                         DLIST_REMOVE(children, child);
    310                         SAFE_FREE(tmp);
    311                         num_children -= 1;
    312                         return;
    313                 }
    314         }
    315 
    316         /* not all forked child processes are added to the children list */
    317         DEBUG(1, ("Could not find child %d -- ignoring\n", (int)pid));
    318327}
    319328
     
    442451         * the global random state in the parent.
    443452         */
    444         generate_random_buffer((uint8_t *)&unique_id, sizeof(unique_id));
     453        unique_id = serverid_get_random_unique_id();
    445454
    446455        pid = sys_fork();
     
    611620}
    612621
    613 static bool smbd_parent_housekeeping(const struct timeval *now, void *private_data)
    614 {
    615         time_t printcap_cache_time = (time_t)lp_printcap_cache_time();
    616         time_t t = time_mono(NULL);
    617 
    618         DEBUG(5, ("parent housekeeping\n"));
    619 
    620         /* if periodic printcap rescan is enabled, see if it's time to reload */
    621         if ((printcap_cache_time != 0)
    622          && (t >= (last_printer_reload_time + printcap_cache_time))) {
    623                 DEBUG( 3,( "Printcap cache time expired.\n"));
    624                 pcap_cache_reload(server_event_context(),
    625                                   smbd_messaging_context(),
    626                                   &reload_pcap_change_notify);
    627                 last_printer_reload_time = t;
    628         }
    629 
    630         return true;
    631 }
    632 
    633622/****************************************************************************
    634623 Open the socket communication.
     
    642631        int i;
    643632        char *ports;
     633        char *tok;
     634        const char *ptr;
    644635        unsigned dns_port = 0;
    645636
     
    663654        }
    664655
     656        for (ptr = ports;
     657             next_token_talloc(talloc_tos(),&ptr, &tok, " \t,");) {
     658                unsigned port = atoi(tok);
     659
     660                if (port == 0 || port > 0xffff) {
     661                        exit_server_cleanly("Invalid port in the config or on "
     662                                            "the commandline specified!");
     663                }
     664        }
     665
    665666        if (lp_interfaces() && lp_bind_interfaces_only()) {
    666667                /* We have been given an interfaces line, and been
     
    674675                        const struct sockaddr_storage *ifss =
    675676                                        iface_n_sockaddr_storage(i);
    676                         char *tok;
    677                         const char *ptr;
    678677
    679678                        if (ifss == NULL) {
     
    687686                             next_token_talloc(talloc_tos(),&ptr, &tok, " \t,");) {
    688687                                unsigned port = atoi(tok);
    689                                 if (port == 0 || port > 0xffff) {
    690                                         continue;
    691                                 }
    692688
    693689                                /* Keep the first port for mDNS service
     
    707703                   from anywhere. */
    708704
    709                 char *tok;
    710                 const char *ptr;
    711705                const char *sock_addr = lp_socket_address();
    712706                char *sock_tok;
     
    726720                        for (ptr=ports; next_token_talloc(talloc_tos(), &ptr, &tok, " \t,"); ) {
    727721                                struct sockaddr_storage ss;
    728 
    729722                                unsigned port = atoi(tok);
    730                                 if (port == 0 || port > 0xffff) {
    731                                         continue;
    732                                 }
    733723
    734724                                /* Keep the first port for mDNS service
     
    769759                DEBUG(0, ("open_sockets_smbd: Failed to register "
    770760                          "myself in serverid.tdb\n"));
    771                 return false;
    772         }
    773 
    774         if (!(event_add_idle(smbd_event_context(), NULL,
    775                              timeval_set(SMBD_HOUSEKEEPING_INTERVAL, 0),
    776                              "parent_housekeeping", smbd_parent_housekeeping,
    777                              NULL))) {
    778                 DEBUG(0, ("Could not add parent_housekeeping event\n"));
    779761                return false;
    780762        }
     
    915897        TALLOC_CTX *frame;
    916898        NTSTATUS status;
    917         uint64_t unique_id;
    918899
    919900        /*
     
    11141095        }
    11151096
    1116         generate_random_buffer((uint8_t *)&unique_id, sizeof(unique_id));
    1117         set_my_unique_id(unique_id);
     1097        set_my_unique_id(serverid_get_random_unique_id());
    11181098
    11191099#if HAVE_SETPGID
     
    12061186                exit(1);
    12071187
    1208         if (!print_backend_init(smbd_messaging_context()))
    1209                 exit(1);
    1210 
    12111188        /* Open the share_info.tdb here, so we don't have to open
    12121189           after the fork on every single connection.  This is a small
     
    12501227                exit(1);
    12511228        }
     1229
     1230        /*
     1231         * The print backend init also migrates the printing tdb's,
     1232         * this requires a winreg pipe.
     1233         */
     1234        if (!print_backend_init(smbd_messaging_context()))
     1235                exit(1);
    12521236
    12531237        /* Publish nt printers, this requires a working winreg pipe */
Note: See TracChangeset for help on using the changeset viewer.