summaryrefslogtreecommitdiff
path: root/examples/libsmbclient/testsmbc.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/libsmbclient/testsmbc.c')
-rw-r--r--examples/libsmbclient/testsmbc.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/examples/libsmbclient/testsmbc.c b/examples/libsmbclient/testsmbc.c
index 45e67bee62c..888a9c0d4f9 100644
--- a/examples/libsmbclient/testsmbc.c
+++ b/examples/libsmbclient/testsmbc.c
@@ -27,7 +27,40 @@
#include <unistd.h>
#include <stdlib.h>
#include <libsmbclient.h>
-#include "get_auth_data_fn.h"
+
+void auth_fn(const char *server, const char *share,
+ char *workgroup, int wgmaxlen, char *username, int unmaxlen,
+ char *password, int pwmaxlen)
+{
+ char temp[128];
+
+ fprintf(stdout, "Need password for //%s/%s\n", server, share);
+
+ fprintf(stdout, "Enter workgroup: [%s] ", workgroup);
+ fgets(temp, sizeof(temp), stdin);
+
+ if (temp[strlen(temp) - 1] == 0x0a) /* A new line? */
+ temp[strlen(temp) - 1] = 0x00;
+
+ if (temp[0]) strncpy(workgroup, temp, wgmaxlen - 1);
+
+ fprintf(stdout, "Enter username: [%s] ", username);
+ fgets(temp, sizeof(temp), stdin);
+
+ if (temp[strlen(temp) - 1] == 0x0a) /* A new line? */
+ temp[strlen(temp) - 1] = 0x00;
+
+ if (temp[0]) strncpy(username, temp, unmaxlen - 1);
+
+ fprintf(stdout, "Enter password: [%s] ", password);
+ fgets(temp, sizeof(temp), stdin);
+
+ if (temp[strlen(temp) - 1] == 0x0a) /* A new line? */
+ temp[strlen(temp) - 1] = 0x00;
+
+ if (temp[0]) strncpy(password, temp, pwmaxlen - 1);
+
+}
int global_id = 0;
@@ -51,7 +84,7 @@ int main(int argc, char *argv[])
char *dirp;
struct stat st1, st2;
- err = smbc_init(get_auth_data_fn, 10); /* Initialize things */
+ err = smbc_init(auth_fn, 10); /* Initialize things */
if (err < 0) {
@@ -99,7 +132,7 @@ int main(int argc, char *argv[])
((struct smbc_dirent *)dirp)->comment);
dirp += dsize;
- dirc -= dsize;
+ (char *)dirc -= dsize;
}