The Samba-Bugzilla – Attachment 2909 Details for
Bug 4944
Iconv-patch does not convert command-line args
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Proposed patch for converting command-line args
rsync_iconv_pathname_fix-20070821-0504GMT.diff (text/plain), 3.03 KB, created by
Andre Raabe
on 2007-08-31 06:16:38 UTC
(
hide
)
Description:
Proposed patch for converting command-line args
Filename:
MIME Type:
Creator:
Andre Raabe
Created:
2007-08-31 06:16:38 UTC
Size:
3.03 KB
patch
obsolete
>diff -Nurbd rsync-HEAD-20070821-0504GMT.orig/io.c rsync-HEAD-20070821-0504GMT/io.c >--- rsync-HEAD-20070821-0504GMT.orig/io.c 2007-07-12 16:04:49.000000000 +0200 >+++ rsync-HEAD-20070821-0504GMT/io.c 2007-08-30 15:02:51.000000000 +0200 >@@ -499,6 +499,7 @@ > *obuf++ = *ibuf++; > ocnt--, len--; > } >+ *obuf = '\0'; > n = obuf - buffer; > writefd_unbuffered(fd, buffer, n); > } >diff -Nurbd rsync-HEAD-20070821-0504GMT.orig/main.c rsync-HEAD-20070821-0504GMT/main.c >--- rsync-HEAD-20070821-0504GMT.orig/main.c 2007-08-14 07:07:01.000000000 +0200 >+++ rsync-HEAD-20070821-0504GMT/main.c 2007-08-30 15:08:28.000000000 +0200 >@@ -71,6 +71,9 @@ > extern char *password_file; > extern char curr_dir[MAXPATHLEN]; > extern struct filter_list_struct server_filter_list; >+#ifdef ICONV_OPTION >+extern iconv_t ic_send, ic_recv; >+#endif > > int local_server = 0; > int new_root_dir = 0; >@@ -1049,6 +1052,49 @@ > return 0; > } > >+#ifdef ICONV_OPTION >+static char *convert_pathname(const char *path) >+{ >+ char buffer[BIGPATHBUFLEN]; >+ int path_len = 0; >+ char *tmp = NULL; >+ >+ if (!path) >+ return NULL; >+ >+ setup_iconv(); >+ >+ *buffer = '\0'; >+ path_len = strlen(path); >+ if (verbose > 4) >+ rprintf(FINFO,"path=%s path_len=%d\n", path, path_len); >+ >+ iconv(ic_send, NULL, 0, NULL, 0); >+ while (path_len) { >+ ICONV_CONST char *ibuf = (ICONV_CONST char *)path; >+ char *obuf = buffer; >+ size_t ocnt = sizeof buffer; >+ while (path_len >+ && iconv(ic_send, &ibuf, &path_len, >+ &obuf, &ocnt) == (size_t)-1) { >+ if (errno == E2BIG || !ocnt) { >+ break; /* Error or no buffer left, stop converting*/ >+ } >+ *obuf++ = *ibuf++; >+ ocnt--, path_len--; >+ } >+ *obuf = '\0'; >+ } >+ if (verbose > 4) >+ rprintf(FINFO,"buffer=%s buffer_len=%d buffer_size=%d\n", buffer,strlen(buffer),sizeof(buffer)); >+ >+ if (!(tmp = strdup(buffer))) { >+ return NULL; /* out of memory */ >+ } >+ return tmp; >+} >+#endif >+ > > /** > * Start a client for either type of remote connection. Work out >@@ -1064,6 +1110,9 @@ > char *shell_machine = NULL; > char *shell_path = NULL; > char *shell_user = NULL; >+#ifdef ICONV_OPTION >+ char *shell_path_conv = NULL; >+#endif > int ret; > pid_t pid; > int f_in,f_out; >@@ -1079,6 +1128,7 @@ > if (shell_path) { /* source is remote */ > char *dummy1; > int dummy2; >+ > if (--argc > && check_for_hostspec(argv[argc], &dummy1, &dummy2)) { > rprintf(FERROR, >@@ -1169,6 +1219,23 @@ > if (!am_sender && argc == 0) > list_only |= 1; > >+#ifdef ICONV_OPTION >+ if (!local_server) { /* Only convert if we aren't local */ >+ if (verbose > 4) >+ rprintf(FINFO,"shell_path=%s len=%d \n", shell_path,strlen(shell_path)); >+ shell_path_conv = convert_pathname(shell_path); >+ if (shell_path_conv == NULL) { >+ rprintf (FERROR, "out of memory at %s(%d)\n", >+ __FILE__, __LINE__); >+ return RERR_MALLOC; >+ } else { >+ if (verbose > 4) >+ rprintf(FINFO,"shell_path_conv=%s len=%d \n", shell_path_conv,strlen(shell_path_conv)); >+ shell_path = shell_path_conv; >+ } >+ } >+#endif >+ > pid = do_cmd(shell_cmd,shell_machine,shell_user,shell_path, > &f_in,&f_out); >
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 4944
: 2909