Changeset 746 for vendor/current/source3/smbd/server.c
- Timestamp:
- Nov 27, 2012, 4:56:06 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/smbd/server.c
r740 r746 65 65 */ 66 66 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 67 73 client_addr(fd, sconn->client_id.addr, sizeof(sconn->client_id.addr)); 68 74 … … 277 283 static struct timed_event *cleanup_te; 278 284 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 } 279 304 280 305 if (unclean_shutdown) { … … 296 321 } 297 322 298 child_id = procid_self(); /* Just initialize pid and potentially vnn */299 child_id.pid = pid;300 301 323 if (!serverid_deregister(child_id)) { 302 324 DEBUG(1, ("Could not remove pid %d from serverid.tdb\n", 303 325 (int)pid)); 304 326 } 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));318 327 } 319 328 … … 442 451 * the global random state in the parent. 443 452 */ 444 generate_random_buffer((uint8_t *)&unique_id, sizeof(unique_id));453 unique_id = serverid_get_random_unique_id(); 445 454 446 455 pid = sys_fork(); … … 611 620 } 612 621 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 633 622 /**************************************************************************** 634 623 Open the socket communication. … … 642 631 int i; 643 632 char *ports; 633 char *tok; 634 const char *ptr; 644 635 unsigned dns_port = 0; 645 636 … … 663 654 } 664 655 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 665 666 if (lp_interfaces() && lp_bind_interfaces_only()) { 666 667 /* We have been given an interfaces line, and been … … 674 675 const struct sockaddr_storage *ifss = 675 676 iface_n_sockaddr_storage(i); 676 char *tok;677 const char *ptr;678 677 679 678 if (ifss == NULL) { … … 687 686 next_token_talloc(talloc_tos(),&ptr, &tok, " \t,");) { 688 687 unsigned port = atoi(tok); 689 if (port == 0 || port > 0xffff) {690 continue;691 }692 688 693 689 /* Keep the first port for mDNS service … … 707 703 from anywhere. */ 708 704 709 char *tok;710 const char *ptr;711 705 const char *sock_addr = lp_socket_address(); 712 706 char *sock_tok; … … 726 720 for (ptr=ports; next_token_talloc(talloc_tos(), &ptr, &tok, " \t,"); ) { 727 721 struct sockaddr_storage ss; 728 729 722 unsigned port = atoi(tok); 730 if (port == 0 || port > 0xffff) {731 continue;732 }733 723 734 724 /* Keep the first port for mDNS service … … 769 759 DEBUG(0, ("open_sockets_smbd: Failed to register " 770 760 "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"));779 761 return false; 780 762 } … … 915 897 TALLOC_CTX *frame; 916 898 NTSTATUS status; 917 uint64_t unique_id;918 899 919 900 /* … … 1114 1095 } 1115 1096 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()); 1118 1098 1119 1099 #if HAVE_SETPGID … … 1206 1186 exit(1); 1207 1187 1208 if (!print_backend_init(smbd_messaging_context()))1209 exit(1);1210 1211 1188 /* Open the share_info.tdb here, so we don't have to open 1212 1189 after the fork on every single connection. This is a small … … 1250 1227 exit(1); 1251 1228 } 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); 1252 1236 1253 1237 /* Publish nt printers, this requires a working winreg pipe */
Note:
See TracChangeset
for help on using the changeset viewer.