]> granicus.if.org Git - libtirpc/commitdiff
libtirpc_debug: Converted the rest of the #ifdef DEBUGs
authorSteve Dickson <steved@redhat.com>
Mon, 14 Jul 2014 12:46:12 +0000 (08:46 -0400)
committerSteve Dickson <steved@redhat.com>
Thu, 7 Aug 2014 18:41:34 +0000 (14:41 -0400)
Replace the rest of the fprintf(stderr) surrounded
by ifdef DEBUGS with the LIBTIRPC_DEBUG macro

Signed-off-by: Steve Dickson <steved@redhat.com>
src/auth_gss.c
src/getpublickey.c
src/netnamer.c
src/svc_auth_gss.c

index 76bab6699fe21939dcbd10ed72546fd93161a7e6..e636e7e21755e002be074d0d88a211c0ae8a2b9c 100644 (file)
@@ -49,6 +49,8 @@
 #include <netinet/in.h>
 #include <gssapi/gssapi.h>
 
+#include "debug.h"
+
 static void    authgss_nextverf(AUTH *);
 static bool_t  authgss_marshal(AUTH *, XDR *);
 static bool_t  authgss_refresh(AUTH *, void *);
@@ -164,9 +166,7 @@ authgss_create(CLIENT *clnt, gss_name_t name, struct rpc_gss_sec *sec)
                free(auth);
                return (NULL);
        }
-#ifdef DEBUG
-       fprintf(stderr, "authgss_create: name is %p\n", name);
-#endif
+       LIBTIRPC_DEBUG(2, ("authgss_create: name is %p\n", name));
        if (name != GSS_C_NO_NAME) {
                if (gss_duplicate_name(&min_stat, name, &gd->name)
                                                != GSS_S_COMPLETE) {
@@ -179,9 +179,7 @@ authgss_create(CLIENT *clnt, gss_name_t name, struct rpc_gss_sec *sec)
        else
                gd->name = name;
 
-#ifdef DEBUG
-       fprintf(stderr, "authgss_create: gd->name is %p\n", gd->name);
-#endif
+       LIBTIRPC_DEBUG(2, ("authgss_create: gd->name is %p\n", gd->name));
        gd->clnt = clnt;
        gd->ctx = GSS_C_NO_CONTEXT;
        gd->sec = *sec;
@@ -234,9 +232,7 @@ authgss_create_default(CLIENT *clnt, char *service, struct rpc_gss_sec *sec)
        auth = authgss_create(clnt, name, sec);
 
        if (name != GSS_C_NO_NAME) {
-#ifdef DEBUG
-       fprintf(stderr, "authgss_create_default: freeing name %p\n", name);
-#endif
+               LIBTIRPC_DEBUG(1, ("authgss_create_default: freeing name %p\n", name));
                gss_release_name(&min_stat, &name);
        }
 
@@ -627,9 +623,7 @@ authgss_destroy(AUTH *auth)
 
        authgss_destroy_context(auth);
 
-#ifdef DEBUG
-       fprintf(stderr, "authgss_destroy: freeing name %p\n", gd->name);
-#endif
+       LIBTIRPC_DEBUG(2, ("authgss_destroy: freeing name %p\n", gd->name));
        if (gd->name != GSS_C_NO_NAME)
                gss_release_name(&min_stat, &gd->name);
 
index 332c72536f3a82b1eb58ef0d320bd26e866fdcc0..85935d83a803a177824c1946145e4bf84f8e1f29 100644 (file)
@@ -46,6 +46,8 @@
 #include <string.h>
 #include <stdlib.h>
 
+#include "debug.h"
+
 #define PKFILE "/etc/publickey"
 
 /*
@@ -120,9 +122,8 @@ getpublicandprivatekey(key, ret)
                        lookup = NULL;
                        err = yp_match(domain, PKMAP, key, strlen(key), &lookup, &len);
                        if (err) {
-#ifdef DEBUG
-                               fprintf(stderr, "match failed error %d\n", err);
-#endif
+                               LIBTIRPC_DEBUG(1, 
+                                       ("getpublicandprivatekey: match failed error %d\n", err));
                                continue;
                        }
                        lookup[len] = 0;
@@ -131,10 +132,8 @@ getpublicandprivatekey(key, ret)
                        free(lookup);
                        return (2);
 #else /* YP */
-#ifdef DEBUG
-                       fprintf(stderr,
-"Bad record in %s '+' -- NIS not supported in this library copy\n", PKFILE);
-#endif /* DEBUG */
+                       LIBTIRPC_DEBUG(1, 
+("Bad record in %s '+' -- NIS not supported in this library copy\n", PKFILE));
                        continue;
 #endif /* YP */
                } else {
index 9b3b7dc4f545b6f43ae281bc06e7f9cc833eb171..7da2f0d1943e955cd27db9e516c86fe85d51fcb7 100644 (file)
@@ -47,6 +47,8 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+#include "debug.h"
+
 static char    *OPSYS = "unix";
 static char    *NETID = "netid.byname";
 static char    *NETIDFILE = "/etc/netid";
@@ -159,10 +161,8 @@ _getgroups(uname, groups)
                for (i = 0; grp->gr_mem[i]; i++)
                        if (!strcmp(grp->gr_mem[i], uname)) {
                                if (ngroups == NGROUPS) {
-#ifdef DEBUG
-                                       fprintf(stderr,
-                               "initgroups: %s is in too many groups\n", uname);
-#endif
+                                       LIBTIRPC_DEBUG(1,
+                               ("_getgroups: %s is in too many groups\n", uname));
                                        goto toomany;
                                }
                                /* filter out duplicate group entries */
@@ -279,9 +279,7 @@ getnetid(key, ret)
                        err = yp_match(domain, NETID, key,
                                strlen(key), &lookup, &len);
                        if (err) {
-#ifdef DEBUG
-                               fprintf(stderr, "match failed error %d\n", err);
-#endif
+                               LIBTIRPC_DEBUG(1, ("getnetid: match failed error %d\n", err));
                                continue;
                        }
                        lookup[len] = 0;
@@ -291,11 +289,9 @@ getnetid(key, ret)
                                fclose(fd);
                        return (2);
 #else  /* YP */
-#ifdef DEBUG
-                       fprintf(stderr,
-"Bad record in %s '+' -- NIS not supported in this library copy\n",
-                               NETIDFILE);
-#endif
+                       LIBTIRPC_DEBUG(1,
+("Bad record in %s '+' -- NIS not supported in this library copy\n",
+                               NETIDFILE));
                        continue;
 #endif /* YP */
                } else {
index a032dd6d7f58d4237f44966dab6db1defc9df90a..155c8deab752067035be05497c354da22fe31719 100644 (file)
@@ -248,7 +248,6 @@ svcauth_gss_accept_sec_context(struct svc_req *rqst,
                                maj_stat, min_stat);
                        return (FALSE);
                }
-#ifdef DEBUG
 #ifdef HAVE_KRB5
                {
                        gss_buffer_desc mechname;
@@ -269,7 +268,6 @@ svcauth_gss_accept_sec_context(struct svc_req *rqst,
                              gd->cname.length, (char *)gd->cname.value,
                              gd->sec.qop, gd->sec.svc);
 #endif
-#endif /* DEBUG */
                seq = htonl(gr->gr_win);
                seqbuf.value = &seq;
                seqbuf.length = sizeof(seq);