lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r2033 - in debian/nss-pam-ldapd/trunk/debian: . patches

[Date Prev][Date Next] [Thread Prev][Thread Next]

nss-pam-ldapd commit: r2033 - in debian/nss-pam-ldapd/trunk/debian: . patches



Author: arthur
Date: Wed Oct 16 23:23:04 2013
New Revision: 2033
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?revision=2033&view=revision

Log:
implement-nofork.patch: introduce a -n, --nofork option that skips the 
daemonising step on start-up (this is related to Ubuntu bug 806761 and may be 
required to get nslcd working with upstart)

Added:
   debian/nss-pam-ldapd/trunk/debian/patches/
   debian/nss-pam-ldapd/trunk/debian/patches/implement-nofork.patch
   debian/nss-pam-ldapd/trunk/debian/patches/series
Modified:
   debian/nss-pam-ldapd/trunk/debian/changelog

Modified: debian/nss-pam-ldapd/trunk/debian/changelog
==============================================================================
--- debian/nss-pam-ldapd/trunk/debian/changelog Sun Oct  6 16:14:39 2013        
(r2032)
+++ debian/nss-pam-ldapd/trunk/debian/changelog Wed Oct 16 23:23:04 2013        
(r2033)
@@ -1,3 +1,11 @@
+nss-pam-ldapd (0.8.13-3) UNRELEASED; urgency=low
+
+  * implement-nofork.patch: introduce a -n, --nofork option that skips the
+    daemonising step on start-up (this is related to Ubuntu bug 806761 and
+    may be required to get nslcd working with upstart)
+
+ -- Arthur de Jong <adejong@debian.org>  Wed, 16 Oct 2013 23:00:00 +0200
+
 nss-pam-ldapd (0.8.13-2) unstable; urgency=low
 
   * debian/copyright: copyright year updates

Added: debian/nss-pam-ldapd/trunk/debian/patches/implement-nofork.patch
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ debian/nss-pam-ldapd/trunk/debian/patches/implement-nofork.patch    Wed Oct 
16 23:23:04 2013        (r2033)
@@ -0,0 +1,150 @@
+Description: Implement an option to run in the foreground
+ This introduces a -n, --nofork option that skips the deamonising step on
+ start-up. This may be required for running nslcd from upstart.
+Origin: upstream, 
http://arthurdejong.org/git/nss-pam-ldapd/commit/?id=952404da9d9085ba42005b10c2e1813e4d348c73
+Origin: upstream, 
http://arthurdejong.org/git/nss-pam-ldapd/commit/?id=cda6dcdc9722eb551f8698b8711ad2eae2d02ac6
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/806761
+
+--- a/man/nslcd.8.xml
++++ b/man/nslcd.8.xml
+@@ -104,6 +104,18 @@
+     </listitem>
+    </varlistentry>
+ 
++   <varlistentry id="nofork">
++    <term>
++     <option>-n</option>, <option>--nofork</option>
++    </term>
++    <listitem>
++     <para>
++      Do not fork or daemonise and run <command>nslcd</command> in the
++      foreground.
++     </para>
++    </listitem>
++   </varlistentry>
++
+    <varlistentry id="help">
+     <term>
+      <option>--help</option>
+--- a/man/pynslcd.8.xml
++++ b/man/pynslcd.8.xml
+@@ -103,6 +103,18 @@
+     </listitem>
+    </varlistentry>
+ 
++   <varlistentry id="nofork">
++    <term>
++     <option>-n</option>, <option>--nofork</option>
++    </term>
++    <listitem>
++     <para>
++      Do not fork or daemonise and run <command>pynslcd</command> in the
++      foreground.
++     </para>
++    </listitem>
++   </varlistentry>
++
+    <varlistentry id="help">
+     <term>
+      <option>--help</option>
+--- a/nslcd/nslcd.c
++++ b/nslcd/nslcd.c
+@@ -81,6 +81,9 @@
+ /* flag to indicate if we are in debugging mode */
+ static int nslcd_debugging=0;
+ 
++/* flag to indicate we shouldn't daemonize */
++static int nslcd_nofork=0;
++
+ /* flag to indicate user requested the --check option */
+ static int nslcd_checkonly=0;
+ 
+@@ -126,6 +129,7 @@ static void display_usage(FILE *fp,const
+   fprintf(fp,"Name Service LDAP connection daemon.\n");
+   fprintf(fp,"  -c, --check        check if the daemon already is running\n");
+   fprintf(fp,"  -d, --debug        don't fork and print debugging to 
stderr\n");
++  fprintf(fp,"  -n, --nofork       don't fork\n");
+   fprintf(fp,"      --help         display this help and exit\n");
+   fprintf(fp,"      --version      output version information and exit\n");
+   fprintf(fp,"\n"
+@@ -137,11 +141,12 @@ static struct option const nslcd_options
+ {
+   { "check",       no_argument,       NULL, 'c' },
+   { "debug",       no_argument,       NULL, 'd' },
++  { "nofork",      no_argument,       NULL, 'n' },
+   { "help",        no_argument,       NULL, 'h' },
+   { "version",     no_argument,       NULL, 'V' },
+   { NULL, 0, NULL, 0 }
+ };
+-#define NSLCD_OPTIONSTRING "cdhV"
++#define NSLCD_OPTIONSTRING "cndhV"
+ 
+ /* parse command line options and save settings in struct  */
+ static void parse_cmdline(int argc,char *argv[])
+@@ -158,6 +163,9 @@ static void parse_cmdline(int argc,char
+       nslcd_debugging++;
+       log_setdefaultloglevel(LOG_DEBUG);
+       break;
++    case 'n': /* -n, --nofork       don't fork */
++      nslcd_nofork++;
++      break;
+     case 'h': /*     --help         display this help and exit */
+       display_usage(stdout,argv[0]);
+       exit(EXIT_SUCCESS);
+@@ -731,7 +739,7 @@ int main(int argc,char *argv[])
+   for (;i>3;i--)
+     close(i);
+   /* daemonize */
+-  if ((!nslcd_debugging)&&(daemon(0,0)<0))
++  if ((!nslcd_debugging)&&(!nslcd_nofork)&&(daemon(0,0)<0))
+   {
+     log_log(LOG_ERR,"unable to daemonize: %s",strerror(errno));
+     exit(EXIT_FAILURE);
+--- a/pynslcd/pynslcd.py
++++ b/pynslcd/pynslcd.py
+@@ -44,6 +44,9 @@ program_name = 'pynslcd'
+ # flag to indicate whether we are in debugging mode
+ debugging = 0
+ 
++# flag to indicate we shouldn't daemonize
++nofork = False
++
+ # flag to indicate user requested the --check option
+ checkonly = False
+ 
+@@ -103,6 +106,7 @@ def display_usage(fp):
+              "Name Service LDAP connection daemon.\n"
+              "  -c, --check        check if the daemon already is running\n"
+              "  -d, --debug        don't fork and print debugging to stderr\n"
++             "  -n, --nofork       don't fork\n"
+              "      --help         display this help and exit\n"
+              "      --version      output version information and exit\n"
+              "\n"
+@@ -118,7 +122,7 @@ def parse_cmdline():
+     program_name = sys.argv[0] or program_name
+     try:
+         optlist, args = getopt.gnu_getopt(sys.argv[1:],
+-          'cdhV', ('check', 'debug', 'help', 'version', ))
++          'cdnhV', ('check', 'debug', 'nofork', 'help', 'version', ))
+         for flag, arg in optlist:
+             if flag in ('-c', '--check'):
+                 global checkonly
+@@ -126,6 +130,9 @@ def parse_cmdline():
+             elif flag in ('-d', '--debug'):
+                 global debugging
+                 debugging += 1
++            elif flag in ('-n', '--nofork'):
++                global nofork
++                nofork = True
+             elif flag in ('-h', '--help'):
+                 display_usage(sys.stdout)
+                 sys.exit(0)
+@@ -309,7 +316,7 @@ if __name__ == '__main__':
+                       config.NSLCD_PIDFILE)
+         sys.exit(1)
+     # daemonize
+-    if debugging:
++    if debugging or nofork:
+         daemon = pidfile
+     else:
+         daemon = daemon.DaemonContext(

Added: debian/nss-pam-ldapd/trunk/debian/patches/series
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ debian/nss-pam-ldapd/trunk/debian/patches/series    Wed Oct 16 23:23:04 
2013        (r2033)
@@ -0,0 +1 @@
+implement-nofork.patch
-- 
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/