mirror of
https://github.com/rkd77/elinks.git
synced 2025-01-03 14:57:44 -05:00
smb: used string functions instead of snprintf.
This commit is contained in:
parent
a584aacb26
commit
f70196dde8
@ -235,18 +235,27 @@ smb_auth(const char *srv, const char *shr, char *wg, int wglen, char *un,
|
|||||||
static void
|
static void
|
||||||
do_smb(struct connection *conn)
|
do_smb(struct connection *conn)
|
||||||
{
|
{
|
||||||
unsigned char url_data[1024];
|
|
||||||
struct uri *uri = conn->uri;
|
struct uri *uri = conn->uri;
|
||||||
struct auth_entry *auth = find_auth(uri);
|
struct auth_entry *auth = find_auth(uri);
|
||||||
|
struct string string;
|
||||||
unsigned char *url;
|
unsigned char *url;
|
||||||
int dir;
|
int dir;
|
||||||
|
|
||||||
if ((uri->userlen && uri->passwordlen) || !auth || !auth->valid) {
|
if ((uri->userlen && uri->passwordlen) || !auth || !auth->valid) {
|
||||||
url = get_uri_string(uri, URI_BASE);
|
url = get_uri_string(uri, URI_BASE);
|
||||||
} else {
|
} else {
|
||||||
snprintf(url_data, 1024, "smb://%s:%s@%s", auth->user, auth->password,
|
unsigned char *uri_string = get_uri_string(uri, URI_HOST | URI_PORT | URI_DATA);
|
||||||
get_uri_string(uri, URI_HOST | URI_PORT | URI_DATA));
|
|
||||||
url = url_data;
|
if (!uri_string || !init_string(&string)) {
|
||||||
|
smb_error(-S_OUT_OF_MEM);
|
||||||
|
}
|
||||||
|
add_to_string(&string, "smb://");
|
||||||
|
add_to_string(&string, auth->user);
|
||||||
|
add_char_to_string(&string, ':');
|
||||||
|
add_to_string(&string, auth->password);
|
||||||
|
add_char_to_string(&string, '@');
|
||||||
|
add_to_string(&string, uri_string);
|
||||||
|
url = string.source;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!url) {
|
if (!url) {
|
||||||
|
Loading…
Reference in New Issue
Block a user