From e7851ce52e408db4d78a45066ed042708203e7a1 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 22 Dec 1999 01:29:22 +0000 Subject: First cut at unicode sys_xx functions. Now to start moving upwards..... Jeremy. (This used to be commit b5eb009cc3cfd1adc044e91911d59acdb54c30cb) --- source3/include/includes.h | 25 +++++++++++++++++++++++++ source3/include/proto.h | 19 +++++++++++++++++++ source3/include/smb.h | 16 ++++++++++------ 3 files changed, 54 insertions(+), 6 deletions(-) (limited to 'source3/include') diff --git a/source3/include/includes.h b/source3/include/includes.h index e8eb8e28ea..b42f5e0115 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -649,6 +649,31 @@ extern int errno; #define MAXCODEPAGELINES 256 #endif +/* + * Type for wide character dirent structure. + */ + +typedef struct smb_wdirent { + SMB_INO_T d_ino; + SMB_OFF_T d_off; + unsigned short d_reclen; + wpstring d_name; +} SMB_STRUCT_WDIRENT; + +/* + * Type for wide character passwd structure. + */ + +typedef struct smb_wpasswd { + wfstring pw_name; + char *pw_passwd; + uid_t pw_uid; + gid_t pw_gid; + wpstring pw_gecos; + wpstring pw_dir; + wpstring pw_shell; +} SMB_STRUCT_WPASSWD; + /***** automatically generated prototypes *****/ #include "proto.h" diff --git a/source3/include/proto.h b/source3/include/proto.h index 79abdf5f56..18762c32fb 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -182,6 +182,15 @@ int sys_getgroups(int setlen, gid_t *gidset); int sys_setgroups(int setlen, gid_t *gidset); struct passwd *sys_getpwnam(const char *name); struct passwd *sys_getpwuid(uid_t uid); +int wsys_stat(const smb_ucs2_t *wfname,SMB_STRUCT_STAT *sbuf); +int wsys_lstat(const smb_ucs2_t *wfname,SMB_STRUCT_STAT *sbuf); +int wsys_creat(const smb_ucs2_t *wfname, mode_t mode); +int wsys_open(const smb_ucs2_t *wfname, int oflag, mode_t mode); +FILE *wsys_fopen(const smb_ucs2_t *wfname, const char *type); +DIR *wsys_opendir(const smb_ucs2_t *wfname); +smb_ucs2_t *wsys_getwd(smb_ucs2_t *s); +int wsys_chown(const smb_ucs2_t *wfname, uid_t uid, gid_t gid); +int wsys_chroot(const smb_ucs2_t *wfname); /*The following definitions come from lib/time.c */ @@ -423,11 +432,21 @@ void default_unicode_map(smb_ucs2_t **pp_cp_to_ucs2, uint16 **pp_ucs2_to_cp); BOOL load_unicode_map(const char *codepage, smb_ucs2_t **pp_cp_to_ucs2, uint16 **pp_ucs2_to_cp); BOOL load_dos_unicode_map(int codepage); BOOL load_unix_unicode_map(const char *unix_char_set); +smb_ucs2_t *multibyte_to_unicode(smb_ucs2_t *dst, const char *src, + size_t dst_len, smb_ucs2_t *cp_to_ucs2); char *unicode_to_unix(char *dst, const smb_ucs2_t *src, size_t dst_len); +smb_ucs2_t *unix_to_unicode(smb_ucs2_t *dst, const char *src, size_t dst_len); char *unicode_to_dos(char *dst, const smb_ucs2_t *src, size_t dst_len); +smb_ucs2_t *dos_to_unicode(smb_ucs2_t *dst, const char *src, size_t dst_len); size_t wstrlen(const smb_ucs2_t *src); +smb_ucs2_t *safe_wstrcpy(smb_ucs2_t *dest,const smb_ucs2_t *src, size_t maxlength); +smb_ucs2_t *safe_wstrcat(smb_ucs2_t *dest, const smb_ucs2_t *src, size_t maxlength); int wstrcmp(const smb_ucs2_t *s1, const smb_ucs2_t *s2); int wstrncmp(const smb_ucs2_t *s1, const smb_ucs2_t *s2, size_t len); +smb_ucs2_t *wstrstr(const smb_ucs2_t *s1, const smb_ucs2_t *s2); +smb_ucs2_t *wstrchr(const smb_ucs2_t *s, smb_ucs2_t c); +smb_ucs2_t *wstrrchr(const smb_ucs2_t *s, smb_ucs2_t c); +smb_ucs2_t *wstrtok(smb_ucs2_t *s1, const smb_ucs2_t *s2); /*The following definitions come from libsmb/clientgen.c */ diff --git a/source3/include/smb.h b/source3/include/smb.h index de269f1d7d..ec1aaf2273 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -333,6 +333,16 @@ implemented */ typedef char pstring[1024]; typedef char fstring[128]; +/* + * SMB UCS2 (16-bit unicode) internal type. + */ + +typedef uint16 smb_ucs2_t; + +/* ucs2 string types. */ +typedef smb_ucs2_t wpstring[1024]; +typedef smb_ucs2_t wfstring[128]; + /* pipe string names */ #define PIPE_LANMAN "\\PIPE\\LANMAN" #define PIPE_SRVSVC "\\PIPE\\srvsvc" @@ -1792,10 +1802,4 @@ struct nmb_name { #define MAP_TO_GUEST_ON_BAD_USER 1 #define MAP_TO_GUEST_ON_BAD_PASSWORD 2 -/* - * SMB UCS2 (16-bit unicode) internal type. - */ - -typedef uint16 smb_ucs2_t; - #endif /* _SMB_H */ -- cgit