diff options
author | Derrell Lipman <derrell@samba.org> | 2005-05-31 23:42:29 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:57:03 -0500 |
commit | 38c5136ce16ca1f61a0d64a89269ccc556d1d7ea (patch) | |
tree | 7defd6f07ab1da93774b07c8edaf93497f8e90c2 /examples | |
parent | 432878c80e1c9d9b4e66235c603401094df665c3 (diff) | |
download | samba-38c5136ce16ca1f61a0d64a89269ccc556d1d7ea.tar.gz samba-38c5136ce16ca1f61a0d64a89269ccc556d1d7ea.tar.bz2 samba-38c5136ce16ca1f61a0d64a89269ccc556d1d7ea.zip |
r7156: file was missing; svn isn't smart enough to even notify me. sigh.
(This used to be commit fce48fa1b462ded1453520355bf2dce0f607b8dc)
Diffstat (limited to 'examples')
-rw-r--r-- | examples/libsmbclient/get_auth_data_fn.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/examples/libsmbclient/get_auth_data_fn.h b/examples/libsmbclient/get_auth_data_fn.h new file mode 100644 index 0000000000..2954039f0a --- /dev/null +++ b/examples/libsmbclient/get_auth_data_fn.h @@ -0,0 +1,52 @@ +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]; + + fprintf(stdout, "Workgroup: [%s] ", pWorkgroup); + 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); + } + + 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); + } + + fprintf(stdout, "Password: "); + fgets(temp, sizeof(temp), stdin); + + if (temp[strlen(temp) - 1] == '\n') /* A new line? */ + { + temp[strlen(temp) - 1] = '\0'; + } + + if (temp[0] != '\0') + { + strncpy(pPassword, temp, maxLenPassword - 1); + } +} |