]> code.citadel.org Git - citadel.git/blobdiff - webcit/locate_host.c
more doxygen doku.
[citadel.git] / webcit / locate_host.c
index 87d1385aa092735be140ee9d199950a567386597..bf018214c7ad748b827307be693a5319e1c1d36d 100644 (file)
@@ -1,37 +1,24 @@
 /*
- * locate the originating host
+ * $Id$
  */
+/**
+ * \defgroup Hostlookup Examine a socket and determine the name/address of the originating host.
+ */
+/*@{*/
 
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <limits.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <string.h>
-#include <pwd.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <pthread.h>
-#include <signal.h>
 #include "webcit.h"
 
-
-
-
+/**
+ * \brief get a hostname 
+ * \todo buffersize?
+ * \param tbuf the returnbuffer
+ * \param client_socket the sock fd where the client is connected
+ */
 void locate_host(char *tbuf, int client_socket)
 {
        struct sockaddr_in cs;
        struct hostent *ch;
-       int len;
+       socklen_t len;
        char *i;
        int a1, a2, a3, a4;
 
@@ -50,6 +37,7 @@ void locate_host(char *tbuf, int client_socket)
                sprintf(tbuf, "%d.%d.%d.%d", a1, a2, a3, a4);
                return;
        }
-       strncpy(tbuf, ch->h_name, 24);
-       tbuf[24] = 0;
+       safestrncpy(tbuf, ch->h_name, 64);
 }
+
+/*@}*/