[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: port configuration



Hello,

--- Logan Parthipan <zeropulse2001@yahoo.com> wrote:
> Is there a way of configuring the port numbers in
> slapd.conf? Currently I know of only the -h option.
> 

I needed to be able to specify the urls that slapd
starts in the configuration file instead of the
command line. Since nobody suggested anything I
changed a few lines of code and got slapd to accept a
"urls" directive in slapd.conf. 

While this is may not be a needed feature I attach the
patch anyway.

cheers

~logan


=================patch_file==================

diff -C 2 -r
openldap-2.0.21-orig/servers/slapd/config.c
openldap-2.0.21/servers/slapd/config.c
*** openldap-2.0.21/servers/slapd/config.c      Sat
Jan  5 07:38:26 2002
--- openldap-2.0.21-orig/servers/slapd/config.c Tue
Jan 22 11:19:30 2002
***************
*** 46,49 ****
--- 46,50 ----
  char   *slapd_pid_file  = NULL;
  char   *slapd_args_file = NULL;
+ char   *slapd_urls = NULL;

  static char   *fp_getline(FILE *fp, int *lineno);
***************
*** 71,74 ****
--- 72,76 ----
        vals[1] = NULL;

+
        if ( (fp = fopen( fname, "r" )) == NULL ) {
                ldap_syslog = 1;
***************
*** 280,283 ****
--- 282,296 ----

                       
ldap_pvt_thread_pool_maxthreads( &connection_pool, c
);
+
+                 /* get urls */
+                 } else if ( strcasecmp( cargv[0],
"urls" ) == 0 ) {
+                         if ( cargc < 2 ) {
+                                 Debug(
LDAP_DEBUG_ANY,
+             "%s: line %d: missing urls in \"urls
<ldap urls>\" line\n",
+                                     fname, lineno, 0
);
+                                 return( 1 );
+                         }
+
+                         slapd_urls = ch_strdup(
cargv[1] );

                /* get pid file name */
diff -C 2 -r openldap-2.0.21-orig/servers/slapd/main.c
openldap-2.0.21/servers/slapd/main.c
*** openldap-2.0.21-orig/servers/slapd/main.c   Sat
Jan  5 07:38:28 2002
--- openldap-2.0.21/servers/slapd/main.c        Tue
Jan 22 11:36:41 2002
***************
*** 130,133 ****
--- 130,134 ----
        int             rc;
        char *urls = NULL;
+
  #if defined(HAVE_SETUID) && defined(HAVE_SETGID)
        char *username = NULL;
***************
*** 296,299 ****
--- 297,303 ----
  #endif

+ /*
+       if ( urls == NULL ) urls = ch_strdup(
slapd_urls );
+
        if( slapd_daemon_init( urls ) != 0 ) {
                rc = 1;
***************
*** 301,305 ****
                goto stop;
        }
!
  #if defined(HAVE_CHROOT)
        if ( sandbox ) {
--- 305,309 ----
                goto stop;
        }
! */
  #if defined(HAVE_CHROOT)
        if ( sandbox ) {
***************
*** 346,354 ****
        }

!       if ( read_config( configfile ) != 0 ) {
!               rc = 1;
!               SERVICE_EXIT(
ERROR_SERVICE_SPECIFIC_ERROR, 19 );
!               goto destroy;
!       }

        if ( schema_prep( ) != 0 ) {
--- 350,367 ----
        }

!         if ( read_config( configfile ) != 0 ) {
!                 rc = 1;
!                 SERVICE_EXIT(
ERROR_SERVICE_SPECIFIC_ERROR, 19 );
!                 goto destroy;
!         }
!
!         if ( urls == NULL ) urls = ch_strdup(
slapd_urls );
!
!         if( slapd_daemon_init( urls ) != 0 ) {
!                 rc = 1;
!                 SERVICE_EXIT(
ERROR_SERVICE_SPECIFIC_ERROR, 16 );
!                 goto stop;
!         }
!

        if ( schema_prep( ) != 0 ) {
***************
*** 358,361 ****
--- 371,375 ----
                goto destroy;
        }
+

  #ifdef HAVE_TLS
diff -C 2 -r
openldap-2.0.21-orig/servers/slapd/proto-slap.h
openldap-2.0.21/servers/slapd/proto-slap.h
*** openldap-2.0.21-orig/servers/slapd/proto-slap.h   
 Sat Jan  5 07:38:29 2002
--- openldap-2.0.21/servers/slapd/proto-slap.h  Tue
Jan 22 10:48:44 2002
***************
*** 819,822 ****
--- 819,824 ----
  LDAP_SLAPD_F (long)           num_ops_initiated;

+ LDAP_SLAPD_F (char *)         slapd_urls;
+
  LDAP_SLAPD_F (char *)         slapd_pid_file;
  LDAP_SLAPD_F (char *)         slapd_args_file;




__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/