Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to use smb_share_get_list? #122

Open
lingfuyi opened this issue Nov 15, 2017 · 0 comments
Open

Failure to use smb_share_get_list? #122

lingfuyi opened this issue Nov 15, 2017 · 0 comments
Labels

Comments

@lingfuyi
Copy link

lingfuyi commented Nov 15, 2017

hello
when i user the function smb_share_get_list, get the file list is inaccurate, it is the function bug or i used it invalied?

my code is:
errcode_Typedef smb_listfile(const char *ip , char ***file_list , int *len)
{
struct in_addr addr;
smb_session *session;
smb_tid tid;
smb_fd fd;
int ret ;
int i,j ;
session = smb_session_new();
if (session == NULL)
{
printf("ERR_SESSION_NEW\n");
return ERR_SESSION_NEW;
}
inet_aton(ip, &addr);

if (smb_session_connect(session, "",addr.s_addr, SMB_TRANSPORT_TCP))
{
	printf("ERR_CONNECT\n");
	return ERR_CONNECT;
}
smb_session_set_creds(session, "", "login", "");
ret = smb_session_login(session);
if (ret)
{
	printf("ERR_AUTH\n");
	return ERR_AUTH;
}
ret = smb_share_get_list(session, file_list , len);
if (ret)
{
	printf("ERR_smb_share_get_list\n");
	return ERR_AUTH;
}
smb_tree_disconnect(session, tid);
smb_session_destroy(session);
return CODE_OK;

}

int main(void)
{
char **list;
int len , i;

printf("\n----------start list file-----------\n");
smb_listfile("10.44.53.88" , &list , &len);
printf("len=%d\n", len);
for(i = 0 ; i < len ; i++)
{	
	printf("%s\n",list[i] );
}
 smb_share_list_destroy(&list);

}

the print result is:
len=3
share
IPC$
ADMIN$

my real list is:
a --floder
aa--file
ccc--file

what wrong?

@jbkempf jbkempf changed the title faild to use smb_share_get_list? Failure to use smb_share_get_list? Aug 9, 2023
@jbkempf jbkempf added the bug label Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants