1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-27 14:04:05 +03:00
samba-mirror/examples/libsmbclient/get_auth_data_fn.h
Derrell Lipman 38c5136ce1 r7156: file was missing; svn isn't smart enough to even notify me. sigh.
(This used to be commit fce48fa1b462ded1453520355bf2dce0f607b8dc)
2007-10-10 10:57:03 -05:00

53 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);
}
}