2 get_auth_data_fn(const char * pServer
,
12 char server
[256] = { '\0' };
13 char share
[256] = { '\0' };
14 char workgroup
[256] = { '\0' };
15 char username
[256] = { '\0' };
16 char password
[256] = { '\0' };
18 if (strcmp(server
, pServer
) == 0 &&
19 strcmp(share
, pShare
) == 0 &&
23 strncpy(pWorkgroup
, workgroup
, maxLenWorkgroup
- 1);
24 strncpy(pUsername
, username
, maxLenUsername
- 1);
25 strncpy(pPassword
, password
, maxLenPassword
- 1);
29 fprintf(stdout
, "Workgroup: [%s] ", pWorkgroup
);
30 fgets(temp
, sizeof(temp
), stdin
);
32 if (temp
[strlen(temp
) - 1] == '\n') /* A new line? */
34 temp
[strlen(temp
) - 1] = '\0';
39 strncpy(pWorkgroup
, temp
, maxLenWorkgroup
- 1);
42 fprintf(stdout
, "Username: [%s] ", pUsername
);
43 fgets(temp
, sizeof(temp
), stdin
);
45 if (temp
[strlen(temp
) - 1] == '\n') /* A new line? */
47 temp
[strlen(temp
) - 1] = '\0';
52 strncpy(pUsername
, temp
, maxLenUsername
- 1);
55 fprintf(stdout
, "Password: ");
56 fgets(temp
, sizeof(temp
), stdin
);
58 if (temp
[strlen(temp
) - 1] == '\n') /* A new line? */
60 temp
[strlen(temp
) - 1] = '\0';
65 strncpy(pPassword
, temp
, maxLenPassword
- 1);
68 strncpy(workgroup
, pWorkgroup
, sizeof(workgroup
) - 1);
69 strncpy(username
, pUsername
, sizeof(username
) - 1);
70 strncpy(password
, pPassword
, sizeof(password
) - 1);