The Samba-Bugzilla – Attachment 1397 Details for
Bug 3030
struct smbc_dirent wrong comments
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Test-case
main_.cpp (text/plain), 1.60 KB, created by
Radu-Adrian Popescu
on 2005-08-24 07:47:16 UTC
(
hide
)
Description:
Test-case
Filename:
MIME Type:
Creator:
Radu-Adrian Popescu
Created:
2005-08-24 07:47:16 UTC
Size:
1.60 KB
patch
obsolete
>#include <iostream> >extern "C" { >#include <libsmbclient.h> >} > >using namespace std; > >void my_smbc_get_auth_data_fn(const char *srv, const char *shr, char *wg, int wglen, char *un, int unlen, char *pw, int pwlen) { > strcpy(un, "guest"); > strcpy(wg, "ALDRATECH"); > cout << "SRV [" << srv << "]" << endl; > cout << "SHR [" << shr << "]" << endl; > cout << "WG [" << wg << "]" << endl; > cout << "UN [" << un << "]" << endl; > cout << "PW [" << pw << "]" << endl; >} > >void testfoo(const char* dir) { > int e; > if (e=smbc_init(my_smbc_get_auth_data_fn, 1)) { > cerr <<"smbc_init() error " << e << endl; > return; > } > int dh = smbc_opendir(dir); > if (dh < 0) { > cerr << "smbc_opendir() failed" << endl; > return; > } > > struct smbc_dirent* pdent; > for (;;) { > pdent = smbc_readdir(dh); > if (!pdent) break; > string comment; > if (pdent->commentlen) { > comment.append(pdent->comment, pdent->commentlen); > } > switch (pdent->smbc_type) { > case SMBC_WORKGROUP: cout << "[WORKGROUP] "; break; > case SMBC_SERVER: cout << "[SERVER] "; break; > case SMBC_FILE_SHARE: cout << "[FILE_SHARE] "; break; > case SMBC_PRINTER_SHARE: cout << "[PRINTER_SHARE] "; break; > case SMBC_COMMS_SHARE: cout << "[COMMS_SHARE] "; break; > case SMBC_IPC_SHARE: cout << "[IPC_SHARE] "; break; > case SMBC_DIR: cout << "[DIR] "; break; > case SMBC_FILE: cout << "[FILE] "; break; > case SMBC_LINK: cout << "[LINK] "; break; > } > cout << pdent->name << " " << strlen(pdent->name) << ":" << pdent->namelen << " (" << comment << ") " << strlen(pdent->comment) << ":" << pdent->commentlen << endl; > }; >} > >int main(int argc, char* argv[]) { > testfoo(argv[1]); > 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 3030
: 1397