winbindd.c patch to handle configurable smb.conf location

Rob Mason Rob_Mason at eur.3com.com
Mon Apr 30 13:52:06 GMT 2001


I needed winbindd to be able to handle a -s command line parameter for location
of conf file
Below is patch to winbindd.c, to allow it to do this, basically copied out of
smbd/server.c!!

Regards
Rob.
=================================================================
*** winbindd.c Fri Apr 27 15:18:12 2001
--- winbindd.c.modrm     Fri Apr 27 15:18:00 2001
***************
*** 23,28 ****
--- 23,30 ----

  #include "winbindd.h"

+ pstring servicesf = CONFIGFILE;
+
  /* List of all connected clients */

  struct winbindd_cli_state *client_list;
***************
*** 30,39 ****

  /* Reload configuration */

! static BOOL reload_services_file(void)
  {
-         pstring servicesf = CONFIGFILE;
     BOOL ret;

     reopen_logs();
     ret = lp_load(servicesf,False,False,True);
--- 32,48 ----

  /* Reload configuration */

! static BOOL reload_services_file(BOOL test)
  {
     BOOL ret;
+         if (lp_loaded()) {
+                 pstring fname;
+                 pstrcpy(fname,lp_configfile());
+                 if (file_exist(fname,NULL) && !strcsequal(fname,servicesf)) {
+                         pstrcpy(servicesf,fname);
+                         test = False;
+                 }
+         }

     reopen_logs();
     ret = lp_load(servicesf,False,False,True);
***************
*** 552,558 ****
               /* Flush winbindd cache */

               do_flush_caches();
!              reload_services_file();

               /* Close and re-open all connections.  This will also
                  refresh the trusted domains list */
--- 561,567 ----
               /* Flush winbindd cache */

               do_flush_caches();
!              reload_services_file(True);

               /* Close and re-open all connections.  This will also
                  refresh the trusted domains list */
***************
*** 639,645 ****

     /* Initialise samba/rpc client stuff */

!    while ((opt = getopt(argc, argv, "id:")) != EOF) {
          switch (opt) {
          case 'i':
               interactive = True;
--- 648,654 ----

     /* Initialise samba/rpc client stuff */

!    while ((opt = getopt(argc, argv, "ids:")) != EOF) {
          switch (opt) {
          case 'i':
               interactive = True;
***************
*** 647,652 ****
--- 656,665 ----
          case 'd':
               new_debuglevel = atoi(optarg);
               break;
+                 case 's':
+                         pstrcpy(servicesf,optarg);
+                         break;
+
          default:
               printf("Unknown option %c\n", (char)opt);
               exit(1);
***************
*** 670,680 ****
     TimeInit();
     charset_initialise();

     if (!lp_load(CONFIGFILE, True, False, False)) {
          DEBUG(0, ("error opening config file\n"));
          exit(1);
     }
!
     if (new_debuglevel != -1) {
          DEBUGLEVEL = new_debuglevel;
     }
--- 683,701 ----
     TimeInit();
     charset_initialise();

+        /*
+          * Do this before reload_services.
+          */
+
+         if (!reload_services_file(False))
+                 return(-1);
+
+ /*
     if (!lp_load(CONFIGFILE, True, False, False)) {
          DEBUG(0, ("error opening config file\n"));
          exit(1);
     }
! */
     if (new_debuglevel != -1) {
          DEBUGLEVEL = new_debuglevel;
     }







More information about the samba-technical mailing list