]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/resolve.c
Don't even fork a PAM-subprocess if "NoPAM" option is set
[ngircd-alex.git] / src / ngircd / resolve.c
index 26ad103cf58deb6eaf2fbb064563408917f2d969..b88ec11ce6bfa53135f543003590b37e30f3c4b7 100644 (file)
@@ -23,6 +23,7 @@
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <netdb.h>
+#include <signal.h>
 
 #ifdef IDENTAUTH
 #ifdef HAVE_IDENT_H
@@ -41,7 +42,6 @@
 #include "io.h"
 
 
-static void Init_Subprocess PARAMS(( void ));
 static void Do_ResolveAddr PARAMS(( const ng_ipaddr_t *Addr, int Sock, int w_fd ));
 static void Do_ResolveName PARAMS(( const char *Host, int w_fd ));
 
@@ -69,7 +69,7 @@ Resolve_Addr(PROC_STAT * s, const ng_ipaddr_t *Addr, int identsock,
                return true;
        } else if( pid == 0 ) {
                /* Sub process */
-               Init_Subprocess();
+               Log_Init_Subprocess("Resolver");
                Do_ResolveAddr( Addr, identsock, pipefd[1]);
                Log_Exit_Subprocess("Resolver");
                exit(0);
@@ -98,7 +98,7 @@ Resolve_Name( PROC_STAT *s, const char *Host, void (*cbfunc)(int, short))
                return true;
        } else if( pid == 0 ) {
                /* Sub process */
-               Init_Subprocess();
+               Log_Init_Subprocess("Resolver");
                Do_ResolveName(Host, pipefd[1]);
                Log_Exit_Subprocess("Resolver");
                exit(0);
@@ -107,17 +107,6 @@ Resolve_Name( PROC_STAT *s, const char *Host, void (*cbfunc)(int, short))
 } /* Resolve_Name */
 
 
-/**
- * Initialize forked resolver subprocess.
- */
-static void
-Init_Subprocess(void)
-{
-       signal(SIGTERM, Proc_GenericSignalHandler);
-       Log_Init_Subprocess("Resolver");
-}
-
-
 #if !defined(HAVE_GETADDRINFO) || !defined(HAVE_GETNAMEINFO)
 #if !defined(WANT_IPV6) && defined(h_errno)
 static char *
@@ -462,32 +451,4 @@ Do_ResolveName( const char *Host, int w_fd )
 } /* Do_ResolveName */
 
 
-/**
- * Read result of resolver sub-process from pipe
- */
-GLOBAL size_t
-Resolve_Read( PROC_STAT *s, void* readbuf, size_t buflen)
-{
-       ssize_t bytes_read;
-
-       assert(buflen > 0);
-
-       /* Read result from pipe */
-       bytes_read = read(Proc_GetPipeFd(s), readbuf, buflen);
-       if (bytes_read < 0) {
-               if (errno == EAGAIN)
-                       return 0;
-
-               Log( LOG_CRIT, "Resolver: Can't read result: %s!", strerror(errno));
-               bytes_read = 0;
-       }
-#ifdef DEBUG
-       else if (bytes_read == 0)
-               Log( LOG_DEBUG, "Resolver: Can't read result: EOF");
-#endif
-       Proc_Kill(s);
-       return (size_t)bytes_read;
-}
-
-
 /* -eof- */