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' };
20 static int krb5_set
= 1;
22 if (strcmp(server
, pServer
) == 0 &&
23 strcmp(share
, pShare
) == 0 &&
27 strncpy(pWorkgroup
, workgroup
, maxLenWorkgroup
- 1);
28 strncpy(pUsername
, username
, maxLenUsername
- 1);
29 strncpy(pPassword
, password
, maxLenPassword
- 1);
33 if (krb5_set
&& getenv("KRB5CCNAME")) {
38 fprintf(stdout
, "Workgroup: [%s] ", pWorkgroup
);
39 fgets(temp
, sizeof(temp
), stdin
);
41 if (temp
[strlen(temp
) - 1] == '\n') /* A new line? */
43 temp
[strlen(temp
) - 1] = '\0';
48 strncpy(pWorkgroup
, temp
, maxLenWorkgroup
- 1);
51 fprintf(stdout
, "Username: [%s] ", pUsername
);
52 fgets(temp
, sizeof(temp
), stdin
);
54 if (temp
[strlen(temp
) - 1] == '\n') /* A new line? */
56 temp
[strlen(temp
) - 1] = '\0';
61 strncpy(pUsername
, temp
, maxLenUsername
- 1);
64 fprintf(stdout
, "Password: ");
65 fgets(temp
, sizeof(temp
), stdin
);
67 if (temp
[strlen(temp
) - 1] == '\n') /* A new line? */
69 temp
[strlen(temp
) - 1] = '\0';
74 strncpy(pPassword
, temp
, maxLenPassword
- 1);
77 strncpy(workgroup
, pWorkgroup
, sizeof(workgroup
) - 1);
78 strncpy(username
, pUsername
, sizeof(username
) - 1);
79 strncpy(password
, pPassword
, sizeof(password
) - 1);