]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/gssd/svcgssd.c
In recent Fedora builds, the '-D _FORTIFY_SOURCE=2' compile
[nfs-utils.git] / utils / gssd / svcgssd.c
index 0db3762d2d00575240600b753f268da0695ce9c6..6ca0e8d762bf2ae36c321b97bb54f7efbfafd6cf 100644 (file)
@@ -37,7 +37,9 @@
 
 */
 
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif /* HAVE_CONFIG_H */
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -54,6 +56,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <signal.h>
+#include <nfsidmap.h>
 #include "nfslib.h"
 #include "svcgssd.h"
 #include "gss_util.h"
@@ -124,12 +127,16 @@ mydaemon(int nochdir, int noclose)
 }
 
 static void
-release_parent()
+release_parent(void)
 {
        int status;
 
        if (pipefds[1] > 0) {
-               write(pipefds[1], &status, 1);
+               if (write(pipefds[1], &status, 1) != 1) {
+                       printerr(1, 
+                               "WARN: writing to parent pipe failed: errno %d (%s)\n",
+                               errno, strerror(errno));
+               }
                close(pipefds[1]);
                pipefds[1] = -1;
        }
@@ -154,7 +161,7 @@ sig_hup(int signal)
 static void
 usage(char *progname)
 {
-       fprintf(stderr, "usage: %s [-n] [-f] [-v] [-r]\n",
+       fprintf(stderr, "usage: %s [-n] [-f] [-v] [-r] [-i]\n",
                progname);
        exit(1);
 }
@@ -166,15 +173,19 @@ main(int argc, char *argv[])
        int fg = 0;
        int verbosity = 0;
        int rpc_verbosity = 0;
+       int idmap_verbosity = 0;
        int opt;
        extern char *optarg;
        char *progname;
 
-       while ((opt = getopt(argc, argv, "fvrnp:")) != -1) {
+       while ((opt = getopt(argc, argv, "fivrnp:")) != -1) {
                switch (opt) {
                        case 'f':
                                fg = 1;
                                break;
+                       case 'i':
+                               idmap_verbosity++;
+                               break;
                        case 'n':
                                get_creds = 0;
                                break;
@@ -203,6 +214,13 @@ main(int argc, char *argv[])
                printerr(0, "Warning: rpcsec_gss library does not "
                            "support setting debug level\n");
 #endif
+#ifdef HAVE_NFS4_SET_DEBUG
+        nfs4_set_debug(idmap_verbosity, NULL);
+#else
+       if (idmap_verbosity > 0)
+               printerr(0, "Warning: your nfsidmap library does not "
+                           "support setting debug level\n");
+#endif
 
        if (gssd_check_mechs() != 0) {
                printerr(0, "ERROR: Problem with gssapi library\n");