r6149: Fixes bugs #2498 and 2484.
[obnox/samba/samba-obnox.git] / examples / libsmbclient / testbrowse.c
index 8122df5e2e71837c9fce783f73117200a65e198b..27d6a6973882e377f6b4429d7ac14d742408872f 100644 (file)
@@ -5,8 +5,9 @@
 #include <stdio.h>
 #include <string.h>
 #include <popt.h>
-#include <libsmbclient.h>
 #include <stdlib.h>
+#include <libsmbclient.h>
+#include "get_auth_data_fn.h"
 
 void error_message(char * pMessage)
 {
@@ -14,65 +15,6 @@ void error_message(char * pMessage)
 }
 
 
-static void
-get_auth_data_fn(const char * pServer,
-                 const char * pShare,
-                 char * pWorkgroup,
-                 int maxLenWorkgroup,
-                 char * pUsername,
-                 int maxLenUsername,
-                 char * pPassword,
-                 int maxLenPassword)
-    
-{
-    char temp[128];
-    
-    printf("Entered get_auth_data_fn\n");
-
-    fprintf(stdout, "Need password for //%s/%s\n", pServer, pShare);
-    
-    fprintf(stdout, "Username: [%s] ", pUsername);
-    fgets(temp, sizeof(temp), stdin);
-    
-    if (temp[strlen(temp) - 1] == '\n') /* A new line? */
-    {
-        temp[strlen(temp) - 1] = '\0';
-    }
-    
-    if (temp[0] != '\0')
-    {
-        strncpy(pUsername, temp, maxLenUsername - 1);
-    }
-    
-    strcpy(temp, getpass("Password: "));
-    
-    if (temp[strlen(temp) - 1] == '\n') /* A new line? */
-    {
-        temp[strlen(temp) - 1] = '\0';
-    }
-    
-    if (temp[0] != '\0')
-    {
-        strncpy(pPassword, temp, maxLenPassword - 1);
-    }
-
-    fprintf(stdout, "Workgroup: ");
-    fgets(temp, sizeof(temp), stdin);
-    
-    if (temp[strlen(temp) - 1] == '\n') /* A new line? */
-    {
-        temp[strlen(temp) - 1] = '\0';
-    }
-    
-    if (temp[0] != '\0')
-    {
-        strncpy(pWorkgroup, temp, maxLenWorkgroup - 1);
-    }
-
-    putchar('\n');
-}
-
-
 int
 main(int argc, char * argv[])
 {