Finish removal of iconv_convenience in public API's.
[bbaumbach/samba-autobuild/.git] / source4 / torture / basic / utable.c
index 82511aa8f97b1bae7857c29f4053f24e0e0028da..682bc0963eb48ed57a29d415e99aa9131db0979b 100644 (file)
 */
 
 #include "includes.h"
 */
 
 #include "includes.h"
-#include "torture/torture.h"
 #include "system/filesys.h"
 #include "system/locale.h"
 #include "libcli/libcli.h"
 #include "torture/util.h"
 #include "system/filesys.h"
 #include "system/locale.h"
 #include "libcli/libcli.h"
 #include "torture/util.h"
-#include "pstring.h"
+#include "param/param.h"
 
 bool torture_utable(struct torture_context *tctx, 
                                        struct smbcli_state *cli)
 {
 
 bool torture_utable(struct torture_context *tctx, 
                                        struct smbcli_state *cli)
 {
-       fstring fname;
+       char fname[256];
        const char *alt_name;
        int fnum;
        uint8_t c2[4];
        const char *alt_name;
        int fnum;
        uint8_t c2[4];
-       int c, len, fd;
+       int c, fd;
+       size_t len;
        int chars_allowed=0, alt_allowed=0;
        uint8_t valid[0x10000];
 
        int chars_allowed=0, alt_allowed=0;
        uint8_t valid[0x10000];
 
@@ -47,13 +47,13 @@ bool torture_utable(struct torture_context *tctx,
                char *p;
 
                SSVAL(c2, 0, c);
                char *p;
 
                SSVAL(c2, 0, c);
-               fstrcpy(fname, "\\utable\\x");
+               strncpy(fname, "\\utable\\x", sizeof(fname)-1);
                p = fname+strlen(fname);
                len = convert_string(CH_UTF16, CH_UNIX, 
                                     c2, 2, 
                p = fname+strlen(fname);
                len = convert_string(CH_UTF16, CH_UNIX, 
                                     c2, 2, 
-                                    p, sizeof(fname)-strlen(fname));
+                                    p, sizeof(fname)-strlen(fname), false);
                p[len] = 0;
                p[len] = 0;
-               fstrcat(fname,"_a_long_extension");
+               strncat(fname,"_a_long_extension",sizeof(fname)-1);
 
                fnum = smbcli_open(cli->tree, fname, O_RDWR | O_CREAT | O_TRUNC, 
                                DENY_NONE);
 
                fnum = smbcli_open(cli->tree, fname, O_RDWR | O_CREAT | O_TRUNC, 
                                DENY_NONE);
@@ -99,18 +99,20 @@ bool torture_utable(struct torture_context *tctx,
 
 static char *form_name(int c)
 {
 
 static char *form_name(int c)
 {
-       static fstring fname;
+       static char fname[256];
        uint8_t c2[4];
        char *p;
        uint8_t c2[4];
        char *p;
-       int len;
+       size_t len;
 
 
-       fstrcpy(fname, "\\utable\\");
+       strncpy(fname, "\\utable\\", sizeof(fname)-1);
        p = fname+strlen(fname);
        SSVAL(c2, 0, c);
 
        len = convert_string(CH_UTF16, CH_UNIX, 
                             c2, 2, 
        p = fname+strlen(fname);
        SSVAL(c2, 0, c);
 
        len = convert_string(CH_UTF16, CH_UNIX, 
                             c2, 2, 
-                            p, sizeof(fname)-strlen(fname));
+                            p, sizeof(fname)-strlen(fname), false);
+       if (len == -1)
+               return NULL;
        p[len] = 0;
        return fname;
 }
        p[len] = 0;
        return fname;
 }