The Samba-Bugzilla – Attachment 13592 Details for
Bug 5926
POSIX extensions cannot be enabled under libsmbclient
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Fixed test program with context calls
test2.c (text/x-csrc), 1.57 KB, created by
Tom Parker
on 2017-09-13 14:17:07 UTC
(
hide
)
Description:
Fixed test program with context calls
Filename:
MIME Type:
Creator:
Tom Parker
Created:
2017-09-13 14:17:07 UTC
Size:
1.57 KB
patch
obsolete
>#include <libsmbclient.h> >#include <string.h> >#include <stdio.h> >#include <stdlib.h> >#include <unistd.h> >#include <errno.h> >#include <stdbool.h> > >#define STRING_SIZE 255 > >char username[STRING_SIZE]; >char passwd[STRING_SIZE]; >char url[STRING_SIZE]; > >void auth_data_fn(const char *srv, > const char *shr, > char *wg, int wglen, > char *un, int unlen, > char *pw, int pwlen) >{ > printf("Authentication required for SERVER <%s> SHARE <%s> in WORKGROUP <%s>.\n", srv, shr, wg); > strncpy(un, username, unlen); > strncpy(pw, passwd, pwlen); > printf("Returning <%s><%s>\n", un, pw); >} > >int main(int argc, char **argv) >{ > int opt; > SMBCFILE* dh; > > strcpy(username, ""); > strcpy(passwd, ""); > strcpy(url, ""); > > while ((opt = > getopt(argc, argv,"U:P:D:")) != EOF) { > switch (opt) { > case 'U': > strcpy(username, optarg); > break; > case 'P': > strcpy(passwd, optarg); > break; > case 'D': > strcpy(url, optarg); > break; > default: > printf("Bad opt: %d", opt); > exit(1); > } > } > > SMBCCTX *context = smbc_init_context(smbc_new_context()); > smbc_setDebug(context, 4); > smbc_setOptionPosixExtensions(context, true); > smbc_setFunctionAuthData(context, auth_data_fn); > > dh = smbc_getFunctionOpendir(context)(context, url); > if(dh < 0){ > printf("Failed smbc_opendir\n"); > exit(-1); > } > > struct smbc_dirent *pdirent; > //int found = 0; > > while((pdirent = smbc_getFunctionReaddir(context)(context, dh)) != 0) { > //found = 1; > printf("Found entry type <%d>, named <%s>\n", pdirent->smbc_type, pdirent->name); > } > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 5926
:
3768
|
3773
|
13563
|
13582
| 13592 |
13593