Author: kalim Date: 2005-07-26 02:01:15 +0000 (Tue, 26 Jul 2005) New Revision: 8768
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=8768 Log: Authentication function for libsmbclient. Needs some work, but is ok for testing puposes. -Kalim Added: branches/SOC/SAMBA_3_0/source/client/get_auth_data_fn.h Changeset: Added: branches/SOC/SAMBA_3_0/source/client/get_auth_data_fn.h =================================================================== --- branches/SOC/SAMBA_3_0/source/client/get_auth_data_fn.h 2005-07-26 01:57:14 UTC (rev 8767) +++ branches/SOC/SAMBA_3_0/source/client/get_auth_data_fn.h 2005-07-26 02:01:15 UTC (rev 8768) @@ -0,0 +1,52 @@ +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); + } +}
