switched over to a new method of handling uppercase/lowercase mappings
[nivanova/samba-autobuild/.git] / source3 / smbd / server.c
1 /* 
2    Unix SMB/Netbios implementation.
3    Version 1.9.
4    Main SMB server routines
5    Copyright (C) Andrew Tridgell 1992-1998
6    
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11    
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16    
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22 #include "includes.h"
23
24 pstring servicesf = CONFIGFILE;
25 extern pstring debugf;
26 extern fstring global_myworkgroup;
27 extern pstring global_myname;
28
29 int am_parent = 1;
30
31 /* the last message the was processed */
32 int last_message = -1;
33
34 /* a useful macro to debug the last message processed */
35 #define LAST_MESSAGE() smb_fn_name(last_message)
36
37 extern pstring user_socket_options;
38
39 #ifdef WITH_DFS
40 extern int dcelogin_atmost_once;
41 #endif /* WITH_DFS */
42
43 extern fstring remote_machine;
44
45 /* really we should have a top level context structure that has the
46    client file descriptor as an element. That would require a major rewrite :(
47
48    the following 2 functions are an alternative - they make the file
49    descriptor private to smbd
50  */
51 static int server_fd = -1;
52
53 int smbd_server_fd(void)
54 {
55         return server_fd;
56 }
57
58 void smbd_set_server_fd(int fd)
59 {
60         server_fd = fd;
61         client_setfd(fd);
62 }
63
64 /****************************************************************************
65   when exiting, take the whole family
66 ****************************************************************************/
67 static void *dflt_sig(void)
68 {
69         exit_server("caught signal");
70         return NULL;
71 }
72
73 /****************************************************************************
74   Send a SIGTERM to our process group.
75 *****************************************************************************/
76 static void  killkids(void)
77 {
78         if(am_parent) kill(0,SIGTERM);
79 }
80
81 /****************************************************************************
82   process a sam sync message - not sure whether to do this here or
83   somewhere else
84 ****************************************************************************/
85 static void msg_sam_sync(int msg_type, pid_t pid, void *buf, size_t len)
86 {
87         DEBUG(10, ("** sam sync message received, ignoring\n"));
88 }
89
90 /****************************************************************************
91   process a sam sync replicate message - not sure whether to do this here or
92   somewhere else
93 ****************************************************************************/
94 static void msg_sam_repl(int msg_type, pid_t pid, void *buf, size_t len)
95 {
96         uint32 low_serial;
97
98         if (len != sizeof(uint32))
99                 return;
100
101         low_serial = *((uint32 *)buf);
102
103         DEBUG(3, ("received sam replication message, serial = 0x%04x\n",
104                   low_serial));
105 }
106
107 /****************************************************************************
108   open the socket communication
109 ****************************************************************************/
110 static BOOL open_sockets_inetd(void)
111 {
112         /* Started from inetd. fd 0 is the socket. */
113         /* We will abort gracefully when the client or remote system 
114            goes away */
115         smbd_set_server_fd(dup(0));
116         
117         /* close our standard file descriptors */
118         close_low_fds();
119         
120         set_socket_options(smbd_server_fd(),"SO_KEEPALIVE");
121         set_socket_options(smbd_server_fd(),user_socket_options);
122
123         return True;
124 }
125
126
127 /****************************************************************************
128   open the socket communication
129 ****************************************************************************/
130 static BOOL open_sockets(BOOL is_daemon,int port)
131 {
132         int num_interfaces = iface_count();
133         int fd_listenset[FD_SETSIZE];
134         fd_set listen_set;
135         int s;
136         int i;
137
138         if (!is_daemon) {
139                 return open_sockets_inetd();
140         }
141
142                 
143 #ifdef HAVE_ATEXIT
144         {
145                 static int atexit_set;
146                 if(atexit_set == 0) {
147                         atexit_set=1;
148                         atexit(killkids);
149                 }
150         }
151 #endif
152
153         /* Stop zombies */
154         CatchChild();
155                 
156                 
157         FD_ZERO(&listen_set);
158
159         if(lp_interfaces() && lp_bind_interfaces_only()) {
160                 /* We have been given an interfaces line, and been 
161                    told to only bind to those interfaces. Create a
162                    socket per interface and bind to only these.
163                 */
164                 
165                 if(num_interfaces > FD_SETSIZE) {
166                         DEBUG(0,("open_sockets: Too many interfaces specified to bind to. Number was %d \
167 max can be %d\n", 
168                                  num_interfaces, FD_SETSIZE));
169                         return False;
170                 }
171                 
172                 /* Now open a listen socket for each of the
173                    interfaces. */
174                 for(i = 0; i < num_interfaces; i++) {
175                         struct in_addr *ifip = iface_n_ip(i);
176                         
177                         if(ifip == NULL) {
178                                 DEBUG(0,("open_sockets: interface %d has NULL IP address !\n", i));
179                                 continue;
180                         }
181                         s = fd_listenset[i] = open_socket_in(SOCK_STREAM, port, 0, ifip->s_addr, True);
182                         if(s == -1)
183                                 return False;
184
185                         /* ready to listen */
186                         set_socket_options(s,"SO_KEEPALIVE"); 
187                         set_socket_options(s,user_socket_options);
188       
189                         if (listen(s, 5) == -1) {
190                                 DEBUG(0,("listen: %s\n",strerror(errno)));
191                                 close(s);
192                                 return False;
193                         }
194                         FD_SET(s,&listen_set);
195                 }
196         } else {
197                 /* Just bind to 0.0.0.0 - accept connections
198                    from anywhere. */
199                 num_interfaces = 1;
200                 
201                 /* open an incoming socket */
202                 s = open_socket_in(SOCK_STREAM, port, 0,
203                                    interpret_addr(lp_socket_address()),True);
204                 if (s == -1)
205                         return(False);
206                 
207                 /* ready to listen */
208                 set_socket_options(s,"SO_KEEPALIVE"); 
209                 set_socket_options(s,user_socket_options);
210
211                 if (listen(s, 5) == -1) {
212                         DEBUG(0,("open_sockets: listen: %s\n",
213                                  strerror(errno)));
214                         close(s);
215                         return False;
216                 }
217                 
218                 fd_listenset[0] = s;
219                 FD_SET(s,&listen_set);
220         } 
221
222         /* Listen to messages */
223
224         message_register(MSG_SMB_SAM_SYNC, msg_sam_sync);
225         message_register(MSG_SMB_SAM_REPL, msg_sam_repl);
226
227         /* now accept incoming connections - forking a new process
228            for each incoming connection */
229         DEBUG(2,("waiting for a connection\n"));
230         while (1) {
231                 fd_set lfds;
232                 int num;
233                 
234                 /* Free up temporary memory from the main smbd. */
235                 lp_talloc_free();
236
237                 /* Ensure we respond to PING and DEBUG messages from the main smbd. */
238                 message_dispatch();
239
240                 memcpy((char *)&lfds, (char *)&listen_set, 
241                        sizeof(listen_set));
242                 
243                 num = sys_select(FD_SETSIZE,&lfds,NULL);
244                 
245                 if (num == -1 && errno == EINTR) {
246                         extern VOLATILE sig_atomic_t reload_after_sighup;
247
248                         /* check for sighup processing */
249                         if (reload_after_sighup) {
250                                 unbecome_user();
251                                 DEBUG(1,("Reloading services after SIGHUP\n"));
252                                 reload_services(False);
253                                 reload_after_sighup = False;
254                         }
255
256                         continue;
257                 }
258                 
259                 /* check if we need to reload services */
260                 check_reload(time(NULL));
261
262                 /* Find the sockets that are read-ready -
263                    accept on these. */
264                 for( ; num > 0; num--) {
265                         struct sockaddr addr;
266                         socklen_t in_addrlen = sizeof(addr);
267                         
268                         s = -1;
269                         for(i = 0; i < num_interfaces; i++) {
270                                 if(FD_ISSET(fd_listenset[i],&lfds)) {
271                                         s = fd_listenset[i];
272                                         /* Clear this so we don't look
273                                            at it again. */
274                                         FD_CLR(fd_listenset[i],&lfds);
275                                         break;
276                                 }
277                         }
278
279                         smbd_set_server_fd(accept(s,&addr,&in_addrlen));
280                         
281                         if (smbd_server_fd() == -1 && errno == EINTR)
282                                 continue;
283                         
284                         if (smbd_server_fd() == -1) {
285                                 DEBUG(0,("open_sockets: accept: %s\n",
286                                          strerror(errno)));
287                                 continue;
288                         }
289                         
290                         if (smbd_server_fd() != -1 && sys_fork()==0) {
291                                 /* Child code ... */
292                                 
293                                 /* close the listening socket(s) */
294                                 for(i = 0; i < num_interfaces; i++)
295                                         close(fd_listenset[i]);
296                                 
297                                 /* close our standard file
298                                    descriptors */
299                                 close_low_fds();
300                                 am_parent = 0;
301                                 
302                                 set_socket_options(smbd_server_fd(),"SO_KEEPALIVE");
303                                 set_socket_options(smbd_server_fd(),user_socket_options);
304                                 
305                                 /* Reset global variables in util.c so
306                                    that client substitutions will be
307                                    done correctly in the process.  */
308                                 reset_globals_after_fork();
309
310                                 /* tdb needs special fork handling */
311                                 tdb_reopen_all();
312
313                                 return True; 
314                         }
315                         /* The parent doesn't need this socket */
316                         close(smbd_server_fd()); 
317
318                         /* Sun May 6 18:56:14 2001 ackley@cs.unm.edu:
319                                 Clear the closed fd info out of server_fd --
320                                 and more importantly, out of client_fd in
321                                 util_sock.c, to avoid a possible
322                                 getpeername failure if we reopen the logs
323                                 and use %I in the filename.
324                         */
325
326                         smbd_set_server_fd(-1);
327
328                         /* Force parent to check log size after
329                          * spawning child.  Fix from
330                          * klausr@ITAP.Physik.Uni-Stuttgart.De.  The
331                          * parent smbd will log to logserver.smb.  It
332                          * writes only two messages for each child
333                          * started/finished. But each child writes,
334                          * say, 50 messages also in logserver.smb,
335                          * begining with the debug_count of the
336                          * parent, before the child opens its own log
337                          * file logserver.client. In a worst case
338                          * scenario the size of logserver.smb would be
339                          * checked after about 50*50=2500 messages
340                          * (ca. 100kb).
341                          * */
342                         force_check_log_size();
343  
344                 } /* end for num */
345         } /* end while 1 */
346
347 /* NOTREACHED   return True; */
348 }
349
350 /****************************************************************************
351   reload the services file
352   **************************************************************************/
353 BOOL reload_services(BOOL test)
354 {
355         BOOL ret;
356         
357         if (lp_loaded()) {
358                 pstring fname;
359                 pstrcpy(fname,lp_configfile());
360                 if (file_exist(fname,NULL) && !strcsequal(fname,servicesf)) {
361                         pstrcpy(servicesf,fname);
362                         test = False;
363                 }
364         }
365
366         reopen_logs();
367
368         if (test && !lp_file_list_changed())
369                 return(True);
370
371         lp_killunused(conn_snum_used);
372         
373         ret = lp_load(servicesf,False,False,True);
374
375         load_printers();
376
377         /* perhaps the config filename is now set */
378         if (!test)
379                 reload_services(True);
380
381         reopen_logs();
382
383         load_interfaces();
384
385         {
386                 if (smbd_server_fd() != -1) {      
387                         set_socket_options(smbd_server_fd(),"SO_KEEPALIVE");
388                         set_socket_options(smbd_server_fd(),user_socket_options);
389                 }
390         }
391
392         reset_mangled_cache();
393         reset_stat_cache();
394
395         /* this forces service parameters to be flushed */
396         become_service(NULL,True);
397
398         return(ret);
399 }
400
401
402
403 /****************************************************************************
404  Catch a sighup.
405 ****************************************************************************/
406
407 VOLATILE sig_atomic_t reload_after_sighup = False;
408
409 static void sig_hup(int sig)
410 {
411         BlockSignals(True,SIGHUP);
412         DEBUG(0,("Got SIGHUP\n"));
413
414         sys_select_signal();
415         reload_after_sighup = True;
416         BlockSignals(False,SIGHUP);
417 }
418
419
420
421 #if DUMP_CORE
422 /*******************************************************************
423 prepare to dump a core file - carefully!
424 ********************************************************************/
425 static BOOL dump_core(void)
426 {
427         char *p;
428         pstring dname;
429         pstrcpy(dname,debugf);
430         if ((p=strrchr_m(dname,'/'))) *p=0;
431         pstrcat(dname,"/corefiles");
432         mkdir(dname,0700);
433         sys_chown(dname,getuid(),getgid());
434         chmod(dname,0700);
435         if (chdir(dname)) return(False);
436         umask(~(0700));
437
438 #ifdef HAVE_GETRLIMIT
439 #ifdef RLIMIT_CORE
440         {
441                 struct rlimit rlp;
442                 getrlimit(RLIMIT_CORE, &rlp);
443                 rlp.rlim_cur = MAX(4*1024*1024,rlp.rlim_cur);
444                 setrlimit(RLIMIT_CORE, &rlp);
445                 getrlimit(RLIMIT_CORE, &rlp);
446                 DEBUG(3,("Core limits now %d %d\n",
447                          (int)rlp.rlim_cur,(int)rlp.rlim_max));
448         }
449 #endif
450 #endif
451
452
453         DEBUG(0,("Dumping core in %s\n",dname));
454         abort();
455         return(True);
456 }
457 #endif
458
459 /****************************************************************************
460 update the current smbd process count
461 ****************************************************************************/
462
463 static void decrement_smbd_process_count(void)
464 {
465         int total_smbds;
466
467         if (lp_max_smbd_processes()) {
468                 total_smbds = 0;
469                 tdb_change_int_atomic(conn_tdb_ctx(), "INFO/total_smbds", &total_smbds, -1);
470         }
471 }
472
473 /****************************************************************************
474 exit the server
475 ****************************************************************************/
476 void exit_server(char *reason)
477 {
478         static int firsttime=1;
479         extern char *last_inbuf;
480
481
482         if (!firsttime) exit(0);
483         firsttime = 0;
484
485         unbecome_user();
486         DEBUG(2,("Closing connections\n"));
487
488         conn_close_all();
489
490         invalidate_all_vuids();
491
492         /* delete our entry in the connections database. */
493         yield_connection(NULL,"",MAXSTATUS);
494
495         respond_to_all_remaining_local_messages();
496         decrement_smbd_process_count();
497
498 #ifdef WITH_DFS
499         if (dcelogin_atmost_once) {
500                 dfs_unlogin();
501         }
502 #endif
503
504         if (!reason) {   
505                 int oldlevel = DEBUGLEVEL;
506                 DEBUGLEVEL = 10;
507                 DEBUG(0,("Last message was %s\n",smb_fn_name(last_message)));
508                 if (last_inbuf)
509                         show_msg(last_inbuf);
510                 DEBUGLEVEL = oldlevel;
511                 DEBUG(0,("===============================================================\n"));
512 #if DUMP_CORE
513                 if (dump_core()) return;
514 #endif
515         }    
516
517         locking_end();
518
519         DEBUG(3,("Server exit (%s)\n", (reason ? reason : "")));
520         exit(0);
521 }
522
523 /****************************************************************************
524   initialise connect, service and file structs
525 ****************************************************************************/
526 static void init_structs(void )
527 {
528         /*
529          * Set the machine NETBIOS name if not already
530          * set from the config file.
531          */
532
533         if (!*global_myname) {
534                 char *p;
535                 fstrcpy( global_myname, myhostname() );
536                 p = strchr_m( global_myname, '.' );
537                 if (p) 
538                         *p = 0;
539         }
540
541         strupper( global_myname );
542
543         conn_init();
544
545         file_init();
546
547         /* for RPC pipes */
548         init_rpc_pipe_hnd();
549
550         init_dptrs();
551
552         secrets_init();
553 }
554
555 /****************************************************************************
556 usage on the program
557 ****************************************************************************/
558 static void usage(char *pname)
559 {
560
561         d_printf("Usage: %s [-DaoPh?Vb] [-d debuglevel] [-l log basename] [-p port]\n", pname);
562         d_printf("       [-O socket options] [-s services file]\n");
563         d_printf("\t-D                    Become a daemon\n");
564         d_printf("\t-a                    Append to log file (default)\n");
565         d_printf("\t-o                    Overwrite log file, don't append\n");
566         d_printf("\t-h                    Print usage\n");
567         d_printf("\t-?                    Print usage\n");
568         d_printf("\t-V                    Print version\n");
569         d_printf("\t-b                    Print build options\n");
570         d_printf("\t-d debuglevel         Set the debuglevel\n");
571         d_printf("\t-l log basename.      Basename for log/debug files\n");
572         d_printf("\t-p port               Listen on the specified port\n");
573         d_printf("\t-O socket options     Socket options\n");
574         d_printf("\t-s services file.     Filename of services file\n");
575         d_printf("\n");
576 }
577
578 /****************************************************************************
579   main program
580 ****************************************************************************/
581  int main(int argc,char *argv[])
582 {
583         extern BOOL append_log;
584         /* shall I run as a daemon */
585         BOOL is_daemon = False;
586         BOOL specified_logfile = False;
587         int port = SMB_PORT;
588         int opt;
589         extern char *optarg;
590         
591 #ifdef HAVE_SET_AUTH_PARAMETERS
592         set_auth_parameters(argc,argv);
593 #endif
594
595         /* this is for people who can't start the program correctly */
596         while (argc > 1 && (*argv[1] != '-')) {
597                 argv++;
598                 argc--;
599         }
600
601         while ( EOF != (opt = getopt(argc, argv, "O:l:s:d:Dp:h?bVaof:")) )
602                 switch (opt)  {
603                 case 'O':
604                         pstrcpy(user_socket_options,optarg);
605                         break;
606
607                 case 's':
608                         pstrcpy(servicesf,optarg);
609                         break;
610
611                 case 'l':
612                         specified_logfile = True;
613                         slprintf(debugf, sizeof(debugf)-1, "%s/log.smbd", optarg);
614                         break;
615
616                 case 'a':
617                         append_log = True;
618                         break;
619
620                 case 'o':
621                         append_log = False;
622                         break;
623
624                 case 'D':
625                         is_daemon = True;
626                         break;
627
628                 case 'd':
629                         if (*optarg == 'A')
630                                 DEBUGLEVEL = 10000;
631                         else
632                                 DEBUGLEVEL = atoi(optarg);
633                         break;
634
635                 case 'p':
636                         port = atoi(optarg);
637                         break;
638
639                 case 'h':
640                 case '?':
641                         usage(argv[0]);
642                         exit(0);
643                         break;
644
645                 case 'V':
646                         d_printf("Version %s\n",VERSION);
647                         exit(0);
648                         break;
649                 case 'b':
650                         build_options(True); /* Display output to screen as well as debug */ 
651                         exit(0);
652                         break;
653                 default:
654                         DEBUG(0,("Incorrect program usage - are you sure the command line is correct?\n"));
655                         usage(argv[0]);
656                         exit(1);
657                 }
658
659 #ifdef HAVE_SETLUID
660         /* needed for SecureWare on SCO */
661         setluid(0);
662 #endif
663
664         sec_init();
665
666         load_case_tables();
667
668         append_log = True;
669
670         TimeInit();
671
672         if(!specified_logfile) {
673                 slprintf(debugf, sizeof(debugf)-1, "%s/log.smbd", LOGFILEBASE);
674         }
675
676         pstrcpy(remote_machine, "smbd");
677
678         setup_logging(argv[0],False);
679
680         /* we want to re-seed early to prevent time delays causing
681            client problems at a later date. (tridge) */
682         generate_random_buffer(NULL, 0, False);
683
684         /* make absolutely sure we run as root - to handle cases where people
685            are crazy enough to have it setuid */
686
687         gain_root_privilege();
688         gain_root_group_privilege();
689
690         fault_setup((void (*)(void *))exit_server);
691         CatchSignal(SIGTERM , SIGNAL_CAST dflt_sig);
692
693         /* we are never interested in SIGPIPE */
694         BlockSignals(True,SIGPIPE);
695
696 #if defined(SIGFPE)
697         /* we are never interested in SIGFPE */
698         BlockSignals(True,SIGFPE);
699 #endif
700
701 #if defined(SIGUSR2)
702         /* We are no longer interested in USR2 */
703         BlockSignals(True,SIGUSR2);
704 #endif
705
706         /* POSIX demands that signals are inherited. If the invoking process has
707          * these signals masked, we will have problems, as we won't recieve them. */
708         BlockSignals(False, SIGHUP);
709         BlockSignals(False, SIGUSR1);
710
711         /* we want total control over the permissions on created files,
712            so set our umask to 0 */
713         umask(0);
714
715         init_sec_ctx();
716
717         reopen_logs();
718
719         DEBUG(1,( "smbd version %s started.\n", VERSION));
720         DEBUGADD(1,( "Copyright Andrew Tridgell 1992-1998\n"));
721
722         DEBUG(2,("uid=%d gid=%d euid=%d egid=%d\n",
723                  (int)getuid(),(int)getgid(),(int)geteuid(),(int)getegid()));
724
725         /* Output the build options to the debug log */ 
726         build_options(False);
727
728         if (sizeof(uint16) < 2 || sizeof(uint32) < 4) {
729                 DEBUG(0,("ERROR: Samba is not configured correctly for the word size on your machine\n"));
730                 exit(1);
731         }
732
733         /*
734          * Do this before reload_services.
735          */
736
737         if (!reload_services(False))
738                 return(-1);     
739
740         init_structs();
741
742         /* don't call winbind for our domain if we are the DC */
743         if (lp_domain_logons()) {
744                 winbind_exclude_domain(lp_workgroup());
745         }
746         
747 #ifdef WITH_PROFILE
748         if (!profile_setup(False)) {
749                 DEBUG(0,("ERROR: failed to setup profiling\n"));
750                 return -1;
751         }
752 #endif
753
754 #ifdef WITH_SSL
755         {
756                 extern BOOL sslEnabled;
757                 sslEnabled = lp_ssl_enabled();
758                 if(sslEnabled)
759                         sslutil_init(True);
760         }
761 #endif        /* WITH_SSL */
762
763         fstrcpy(global_myworkgroup, lp_workgroup());
764
765         CatchSignal(SIGHUP,SIGNAL_CAST sig_hup);
766         
767         DEBUG(3,( "loaded services\n"));
768
769         if (!is_daemon && !is_a_socket(0)) {
770                 DEBUG(0,("standard input is not a socket, assuming -D option\n"));
771                 is_daemon = True;
772         }
773
774         if (is_daemon) {
775                 DEBUG( 3, ( "Becoming a daemon.\n" ) );
776                 become_daemon();
777         }
778
779         if (!directory_exist(lp_lockdir(), NULL)) {
780                 mkdir(lp_lockdir(), 0755);
781         }
782
783         if (is_daemon) {
784                 pidfile_create("smbd");
785         }
786
787         if (!message_init()) {
788                 exit(1);
789         }
790
791         /* Setup the main smbd so that we can get messages. */
792         claim_connection(NULL,"",MAXSTATUS,True);
793
794         if (!open_sockets(is_daemon,port))
795                 exit(1);
796
797         /*
798          * everything after this point is run after the fork()
799          */ 
800
801         if (!locking_init(0)) {
802                 exit(1);
803         }
804
805         if (!print_backend_init()) {
806                 exit(1);
807         }
808
809         if (!share_info_db_init()) {
810                 exit(1);
811         }
812
813         if(!initialize_password_db(False)) {
814                 exit(1);
815         }
816
817         /* possibly reload the services file. */
818         reload_services(True);
819
820         if (init_group_mapping()==False) {
821                 printf("Could not open tdb mapping file.\n");
822                 return 0;
823         }
824
825         if(!pdb_generate_sam_sid()) {
826                 DEBUG(0,("ERROR: Samba cannot create a SAM SID.\n"));
827                 exit(1);
828         }
829
830         if (*lp_rootdir()) {
831                 if (sys_chroot(lp_rootdir()) == 0)
832                         DEBUG(2,("Changed root to %s\n", lp_rootdir()));
833         }
834
835         /* Setup oplocks */
836         if (!init_oplocks()) {
837                 exit(1);
838         }
839
840         /* Setup change notify */
841         if (!init_change_notify()) {
842                 exit(1);
843         }
844
845         smbd_process();
846         
847         exit_server("normal exit");
848         return(0);
849 }