mirror of
https://github.com/samba-team/samba.git
synced 2025-02-08 05:57:51 +03:00
Implement enhancement request 3505. Two additional features are added here. There is now a method of saving an opaque user data handle in the smbc_ context, and there is now a way to request that the context be passed to the authentication function. See examples/libsmbclient/testbrowse.c for an example of using these features. (This used to be commit 203b4911c16bd7e10198a6f0e63960f2813025ef)
52 lines
1.2 KiB
C
52 lines
1.2 KiB
C
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);
|
|
}
|
|
}
|