Handle multiple input PDU packages using GDU class of YAZ++ 1.0.
[yazproxy-moved-to-github.git] / src / mod_sample.cpp
index 11c00ad..3e1df6c 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: mod_sample.cpp,v 1.2 2005-02-21 14:27:32 adam Exp $
+/* $Id: mod_sample.cpp,v 1.4 2005-06-21 18:46:04 adam Exp $
    Copyright (c) 1998-2005, Index Data.
 
 This file is part of the yaz-proxy.
@@ -21,6 +21,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 
 #include <string.h>
 #include <stdio.h>
+#include <unistd.h>
 
 #include <yazproxy/module.h>
 
@@ -45,7 +46,8 @@ void my_destroy(void *p)
 int my_authenticate(void *user_handle,
                    const char *target_name,
                    void *element_ptr,
-                   const char *user, const char *group, const char *password)
+                   const char *user, const char *group, const char *password,
+                   const char *peer_IP)
 {
     // see if we have an "args" attribute
     const char *args = 0;
@@ -62,10 +64,13 @@ int my_authenticate(void *user_handle,
 #endif
     // args holds args (or NULL if  none is provided)
 
-    fprintf(stderr, "my_authenticate: target=%s user=%s group=%s args=%s\n",
+    sleep(2);
+    fprintf(stderr, "my_authenticate: target=%s user=%s group=%s args=%s IP=%s"
+           "\n",
            target_name ? target_name : "none", 
            user ? user : "none", group ? group : "none",
-           args ? args : "none");
+           args ? args : "none",
+           peer_IP);
     // authentication handler
     if (!user && !group && !password)
        return YAZPROXY_RET_OK;   // OK if anonymous