--- samba-3.0.25/source/include/libsmbclient.h 2007-02-28 20:54:51.000000000 -0800 +++ samba-3.0.25/source/include/libsmbclient.h.new 2008-08-14 15:05:46.515494000 -0700 @@ -733,6 +733,22 @@ SMBCCTX * smbc_set_context(SMBCCTX * new_context); +/**@ingroup misc + * Set the users credentials globally so they can be used for DFS + * referrals. Probably best to use this function in the smbc_get_auth_data_fn + * callback. + * + * @param workgroup Workgroup of the user. + * + * @param user Username of user. + * + * @param password Password of user. + * + * @param is_kerberos Flag if kerberos should be used. + */ + +void smbc_set_credentials(char *workgroup, char *user, char *password, int is_kerberos); + /**@ingroup file * Open a file on an SMB server. * --- samba-3.0.25/source/libsmb/libsmbclient.c 2007-04-09 10:30:58.000000000 -0700 +++ samba-3.0.25/source/libsmb/libsmbclient.c.new 2008-08-14 15:05:26.006554000 -0700 @@ -6604,6 +6604,24 @@ return context; } +/* Set the credentials so DFS will work when following referrals.*/ +void +smbc_set_credentials(char *workgroup, char *user, char *password, int is_kerberos) +{ + struct user_auth_info auth_info; + pstrcpy(auth_info.username, user); + pstrcpy(auth_info.password, password); + auth_info.got_pass = True; + + if (is_kerberos) + auth_info.use_kerberos = True; + else + auth_info.use_kerberos = False; + + cli_cm_set_credentials(&auth_info); + set_global_myworkgroup(workgroup); +} + /* Return the verion of samba, and thus libsmbclient */ const char *