4 get_auth_data_fn(const char * pServer
,
14 char server
[256] = { '\0' };
15 char share
[256] = { '\0' };
16 char workgroup
[256] = { '\0' };
17 char username
[256] = { '\0' };
18 char password
[256] = { '\0' };
21 static int krb5_set
= 1;
23 if (strcmp(server
, pServer
) == 0 &&
24 strcmp(share
, pShare
) == 0 &&
28 strncpy(pWorkgroup
, workgroup
, maxLenWorkgroup
- 1);
29 strncpy(pUsername
, username
, maxLenUsername
- 1);
30 strncpy(pPassword
, password
, maxLenPassword
- 1);
34 if (krb5_set
&& getenv("KRB5CCNAME")) {
39 fprintf(stdout
, "Workgroup: [%s] ", pWorkgroup
);
40 ret
= fgets(temp
, sizeof(temp
), stdin
);
45 if (temp
[strlen(temp
) - 1] == '\n') /* A new line? */
47 temp
[strlen(temp
) - 1] = '\0';
52 strncpy(pWorkgroup
, temp
, maxLenWorkgroup
- 1);
55 fprintf(stdout
, "Username: [%s] ", pUsername
);
56 ret
= fgets(temp
, sizeof(temp
), stdin
);
61 if (temp
[strlen(temp
) - 1] == '\n') /* A new line? */
63 temp
[strlen(temp
) - 1] = '\0';
68 strncpy(pUsername
, temp
, maxLenUsername
- 1);
71 fprintf(stdout
, "Password: ");
72 ret
= fgets(temp
, sizeof(temp
), stdin
);
77 if (temp
[strlen(temp
) - 1] == '\n') /* A new line? */
79 temp
[strlen(temp
) - 1] = '\0';
84 strncpy(pPassword
, temp
, maxLenPassword
- 1);
87 strncpy(workgroup
, pWorkgroup
, sizeof(workgroup
) - 1);
88 strncpy(username
, pUsername
, sizeof(username
) - 1);
89 strncpy(password
, pPassword
, sizeof(password
) - 1);