#include #include #include char *url; void smbc_auth_fn(SMBCCTX *smbcctx, const char *server, const char *share, char *workgroup, int wgmaxlen, char *username, int unmaxlen, char *password, int pwmaxlen) { workgroup[0] = '\0'; username[0] = '\0'; password[0] = '\0'; } void smbc_test(int n) { SMBCCTX *smbcctx; SMBCFILE *smbcfile; smbc_opendir_fn opendir_fn; printf("Test %d\n", n); smbcctx = smbc_new_context(); smbc_init_context(smbcctx); smbc_setFunctionAuthDataWithContext(smbcctx, smbc_auth_fn); opendir_fn = smbc_getFunctionOpendir(smbcctx); smbcfile = (*opendir_fn)(smbcctx, url); smbc_free_context(smbcctx, 1); } int main(int argc, char **argv) { if (argc < 2) { printf("Usage: %s SMB_URL\n", argv[0]); exit(1); } url = argv[1]; smbc_test(1); smbc_test(2); unsetenv("HOME"); smbc_test(3); exit(0); }