• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/samba-3.0.25b/examples/libsmbclient/
1static void
2get_auth_data_fn(const char * pServer,
3                 const char * pShare,
4                 char * pWorkgroup,
5                 int maxLenWorkgroup,
6                 char * pUsername,
7                 int maxLenUsername,
8                 char * pPassword,
9                 int maxLenPassword)
10{
11    char temp[128];
12
13    fprintf(stdout, "Workgroup: [%s] ", pWorkgroup);
14    fgets(temp, sizeof(temp), stdin);
15
16    if (temp[strlen(temp) - 1] == '\n') /* A new line? */
17    {
18        temp[strlen(temp) - 1] = '\0';
19    }
20
21    if (temp[0] != '\0')
22    {
23        strncpy(pWorkgroup, temp, maxLenWorkgroup - 1);
24    }
25
26    fprintf(stdout, "Username: [%s] ", pUsername);
27    fgets(temp, sizeof(temp), stdin);
28
29    if (temp[strlen(temp) - 1] == '\n') /* A new line? */
30    {
31        temp[strlen(temp) - 1] = '\0';
32    }
33
34    if (temp[0] != '\0')
35    {
36        strncpy(pUsername, temp, maxLenUsername - 1);
37    }
38
39    fprintf(stdout, "Password: ");
40    fgets(temp, sizeof(temp), stdin);
41
42    if (temp[strlen(temp) - 1] == '\n') /* A new line? */
43    {
44        temp[strlen(temp) - 1] = '\0';
45    }
46
47    if (temp[0] != '\0')
48    {
49        strncpy(pPassword, temp, maxLenPassword - 1);
50    }
51}
52