diff options
author | Andrew Tridgell <tridge@samba.org> | 1997-09-14 16:37:18 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1997-09-14 16:37:18 +0000 |
commit | 33a003de4056532be0c9a199d4857b9da1b18034 (patch) | |
tree | 69362f80d2ff1db2d79bd218701f5cff2320f8ed /source3/lib | |
parent | 58ec10049b8029de82e70ba10559e143a1b16707 (diff) | |
download | samba-33a003de4056532be0c9a199d4857b9da1b18034.tar.gz samba-33a003de4056532be0c9a199d4857b9da1b18034.tar.bz2 samba-33a003de4056532be0c9a199d4857b9da1b18034.zip |
This commit does 3 main things:
1) put the encryption code in by default, with no #ifdef. It is still
disabled by default so you need to add "encrypt passwords = yes" in
smb.conf but at least all binaries will have it.
2) cleanup the kanji code so it compiles with no warnings
3) get rid of lots of uses of ugly non-portable C code. The main
offender being things like "register" but also remove uses of the
"const" keyword as there are compilers out there that don't support it
and even those that do often complain about its usage. Users don't
like warnings :-(
There is still some work to do. We need to replace the md4 code with
our own implementation. The current code (from rfc1186) is PD but is
not very portable. The new RFC (rfc1320) is more portable but adds
copyright restrictions. I'll do a from-scratch MD4 soon.
We also need to test that what I've implemented is portable. It should
be, but I'm too tired right now to test it on anything other than
intel linux.
(This used to be commit db917c62c14315afe6f0745a8097c1bca25cbf07)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/getsmbpass.c | 4 | ||||
-rw-r--r-- | source3/lib/kanji.c | 99 | ||||
-rw-r--r-- | source3/lib/md4.c | 4 | ||||
-rw-r--r-- | source3/lib/system.c | 3 | ||||
-rw-r--r-- | source3/lib/util.c | 10 |
5 files changed, 47 insertions, 73 deletions
diff --git a/source3/lib/getsmbpass.c b/source3/lib/getsmbpass.c index 9008d40f91..e8cb683d0b 100644 --- a/source3/lib/getsmbpass.c +++ b/source3/lib/getsmbpass.c @@ -45,7 +45,7 @@ static struct termio t; return ioctl(fd, TCGETA, t); } - int tcsetattr(int fd, int flags, const struct termio *t) + int tcsetattr(int fd, int flags, struct termio *t) { if(flags & TCSAFLUSH) ioctl(fd, TCFLSH, TCIOFLUSH); @@ -76,7 +76,7 @@ static struct sgttyb t; return ioctl(fd, TIOCGETP, (char *)t); } - int tcsetattr(int fd, int flags, const struct sgttyb *t) + int tcsetattr(int fd, int flags, struct sgttyb *t) { return ioctl(fd, TIOCSETP, (char *)t); } diff --git a/source3/lib/kanji.c b/source3/lib/kanji.c index f5888e4877..5d7de87248 100644 --- a/source3/lib/kanji.c +++ b/source3/lib/kanji.c @@ -42,8 +42,7 @@ char hex_tag = HEXTAG; search token from S1 separated any char of S2 S1 contain SHIFT JIS chars. ********************************************************************/ -char * -sj_strtok (char *s1, const char *s2) +char *sj_strtok(char *s1, char *s2) { static char *s = NULL; char *q; @@ -82,10 +81,9 @@ sj_strtok (char *s1, const char *s2) search string S2 from S1 S1 contain SHIFT JIS chars. ********************************************************************/ -char * -sj_strstr (const char *s1, const char *s2) +char *sj_strstr(char *s1, char *s2) { - register int len = strlen ((char *) s2); + int len = strlen ((char *) s2); if (!*s2) return (char *) s1; for (;*s1;) { @@ -106,8 +104,7 @@ sj_strstr (const char *s1, const char *s2) Search char C from beginning of S. S contain SHIFT JIS chars. ********************************************************************/ -char * -sj_strchr (const char *s, int c) +char *sj_strchr (char *s, int c) { for (; *s; ) { if (*s == c) @@ -125,10 +122,9 @@ sj_strchr (const char *s, int c) Search char C end of S. S contain SHIFT JIS chars. ********************************************************************/ -char * -sj_strrchr (const char *s, int c) +char *sj_strrchr(char *s, int c) { - register char *q; + char *q; for (q = 0; *s; ) { if (*s == c) { @@ -152,8 +148,7 @@ static char cvtbuf[1024]; /******************************************************************* EUC <-> SJIS ********************************************************************/ -static int -euc2sjis (register int hi, register int lo) +static int euc2sjis (int hi, int lo) { if (hi & 1) return ((hi / 2 + (hi < 0xdf ? 0x31 : 0x71)) << 8) | @@ -162,8 +157,7 @@ euc2sjis (register int hi, register int lo) return ((hi / 2 + (hi < 0xdf ? 0x30 : 0x70)) << 8) | (lo - 2); } -static int -sjis2euc (register int hi, register int lo) +static int sjis2euc (int hi, int lo) { if (lo >= 0x9f) return ((hi * 2 - (hi >= 0xe0 ? 0xe0 : 0x60)) << 8) | (lo + 2); @@ -176,10 +170,9 @@ sjis2euc (register int hi, register int lo) Convert FROM contain SHIFT JIS codes to EUC codes return converted buffer ********************************************************************/ -static char * -sj_to_euc (const char *from, BOOL overwrite) +static char *sj_to_euc(char *from, BOOL overwrite) { - register char *out; + char *out; char *save; save = (char *) from; @@ -209,10 +202,9 @@ sj_to_euc (const char *from, BOOL overwrite) Convert FROM contain EUC codes to SHIFT JIS codes return converted buffer ********************************************************************/ -static char * -euc_to_sj (const char *from, BOOL overwrite) +static char *euc_to_sj(char *from, BOOL overwrite) { - register char *out; + char *out; char *save; save = (char *) from; @@ -241,8 +233,7 @@ euc_to_sj (const char *from, BOOL overwrite) /******************************************************************* JIS7,JIS8,JUNET <-> SJIS ********************************************************************/ -static int -sjis2jis (register int hi, register int lo) +static int sjis2jis(int hi, int lo) { if (lo >= 0x9f) return ((hi * 2 - (hi >= 0xe0 ? 0x160 : 0xe0)) << 8) | (lo - 0x7e); @@ -251,8 +242,7 @@ sjis2jis (register int hi, register int lo) (lo - (lo >= 0x7f ? 0x20 : 0x1f)); } -static int -jis2sjis (register int hi, register int lo) +static int jis2sjis(int hi, int lo) { if (hi & 1) return ((hi / 2 + (hi < 0x5f ? 0x71 : 0xb1)) << 8) | @@ -265,11 +255,10 @@ jis2sjis (register int hi, register int lo) Convert FROM contain JIS codes to SHIFT JIS codes return converted buffer ********************************************************************/ -static char * -jis8_to_sj (const char *from, BOOL overwrite) +static char *jis8_to_sj(char *from, BOOL overwrite) { - register char *out; - register int shifted; + char *out; + int shifted; char *save; shifted = _KJ_ROMAN; @@ -316,11 +305,10 @@ jis8_to_sj (const char *from, BOOL overwrite) Convert FROM contain SHIFT JIS codes to JIS codes return converted buffer ********************************************************************/ -static char * -sj_to_jis8 (const char *from, BOOL overwrite) +static char *sj_to_jis8(char *from, BOOL overwrite) { - register char *out; - register int shifted; + char *out; + int shifted; char *save; shifted = _KJ_ROMAN; @@ -373,11 +361,10 @@ sj_to_jis8 (const char *from, BOOL overwrite) Convert FROM contain 7 bits JIS codes to SHIFT JIS codes return converted buffer ********************************************************************/ -static char * -jis7_to_sj (const char *from, BOOL overwrite) +static char *jis7_to_sj(char *from, BOOL overwrite) { - register char *out; - register int shifted; + char *out; + int shifted; char *save; shifted = _KJ_ROMAN; @@ -433,11 +420,10 @@ jis7_to_sj (const char *from, BOOL overwrite) Convert FROM contain SHIFT JIS codes to 7 bits JIS codes return converted buffer ********************************************************************/ -static char * -sj_to_jis7 (const char *from, BOOL overwrite) +static char *sj_to_jis7(char *from, BOOL overwrite) { - register char *out; - register int shifted; + char *out; + int shifted; char *save; shifted = _KJ_ROMAN; @@ -510,11 +496,10 @@ sj_to_jis7 (const char *from, BOOL overwrite) Convert FROM contain 7 bits JIS(junet) codes to SHIFT JIS codes return converted buffer ********************************************************************/ -static char * -junet_to_sj (const char *from, BOOL overwrite) +static char *junet_to_sj(char *from, BOOL overwrite) { - register char *out; - register int shifted; + char *out; + int shifted; char *save; shifted = _KJ_ROMAN; @@ -567,11 +552,10 @@ junet_to_sj (const char *from, BOOL overwrite) Convert FROM contain SHIFT JIS codes to 7 bits JIS(junet) codes return converted buffer ********************************************************************/ -static char * -sj_to_junet (const char *from, BOOL overwrite) +static char *sj_to_junet(char *from, BOOL overwrite) { - register char *out; - register int shifted; + char *out; + int shifted; char *save; shifted = _KJ_ROMAN; @@ -637,8 +621,7 @@ sj_to_junet (const char *from, BOOL overwrite) HEX <-> SJIS ********************************************************************/ /* ":xx" -> a byte */ -static char * -hex_to_sj (const char *from, BOOL overwrite) +static char *hex_to_sj(char *from, BOOL overwrite) { char *sp, *dp; @@ -663,8 +646,7 @@ hex_to_sj (const char *from, BOOL overwrite) /******************************************************************* kanji/kana -> ":xx" ********************************************************************/ -static char * -sj_to_hex (const char *from, BOOL overwrite) +static char *sj_to_hex(char *from, BOOL overwrite) { unsigned char *sp, *dp; @@ -700,8 +682,7 @@ sj_to_hex (const char *from, BOOL overwrite) /******************************************************************* kanji/kana -> ":xx" ********************************************************************/ -static char * -sj_to_cap (const char *from, BOOL overwrite) +static char *sj_to_cap(char *from, BOOL overwrite) { unsigned char *sp, *dp; @@ -729,8 +710,7 @@ sj_to_cap (const char *from, BOOL overwrite) /******************************************************************* sj to sj ********************************************************************/ -static char * -sj_to_sj (const char *from, BOOL overwrite) +static char *sj_to_sj(char *from, BOOL overwrite) { if (!overwrite) { strcpy (cvtbuf, (char *) from); @@ -745,11 +725,10 @@ sj_to_sj (const char *from, BOOL overwrite) _dos_to_unix _unix_to_dos ************************************************************************/ -char* (*_dos_to_unix) (const char *str, BOOL overwrite) = sj_to_sj; -char* (*_unix_to_dos) (const char *str, BOOL overwrite) = sj_to_sj; +char *(*_dos_to_unix)(char *str, BOOL overwrite) = sj_to_sj; +char *(*_unix_to_dos)(char *str, BOOL overwrite) = sj_to_sj; -static int -setup_string_function (int codes) +static int setup_string_function(int codes) { switch (codes) { default: diff --git a/source3/lib/md4.c b/source3/lib/md4.c index bdff075c7e..87aafce802 100644 --- a/source3/lib/md4.c +++ b/source3/lib/md4.c @@ -1,4 +1,3 @@ -#ifdef SMB_PASSWD /* This code is from rfc1186. */ @@ -294,6 +293,3 @@ /* ** End of md4.c */ -#else - void md4_dummy() {;} -#endif diff --git a/source3/lib/system.c b/source3/lib/system.c index 447a4f88ac..c539b25883 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -202,8 +202,7 @@ for rename across filesystems Patch from Warren Birnbaum <warrenb@hpcvscdp.cv.hp.com> **********************************************************/ -static int -copy_reg (const char *source, const char *dest) +static int copy_reg(char *source, const char *dest) { struct stat source_stats; int ifd; diff --git a/source3/lib/util.c b/source3/lib/util.c index ce0b8bc768..b0213912d1 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -807,7 +807,7 @@ char *attrib_string(int mode) /******************************************************************* case insensitive string compararison ********************************************************************/ -int StrCaseCmp(const char *s, const char *t) +int StrCaseCmp(char *s, char *t) { /* compare until we run out of string, either t or s, or find a difference */ /* We *must* use toupper rather than tolower here due to the @@ -871,7 +871,7 @@ int StrCaseCmp(const char *s, const char *t) /******************************************************************* case insensitive string compararison, length limited ********************************************************************/ -int StrnCaseCmp(const char *s, const char *t, int n) +int StrnCaseCmp(char *s, char *t, int n) { /* compare until we run out of string, either t or s, or chars */ /* We *must* use toupper rather than tolower here due to the @@ -945,7 +945,7 @@ int StrnCaseCmp(const char *s, const char *t, int n) /******************************************************************* compare 2 strings ********************************************************************/ -BOOL strequal(const char *s1, const char *s2) +BOOL strequal(char *s1, char *s2) { if (s1 == s2) return(True); if (!s1 || !s2) return(False); @@ -956,7 +956,7 @@ BOOL strequal(const char *s1, const char *s2) /******************************************************************* compare 2 strings up to and including the nth char. ******************************************************************/ -BOOL strnequal(const char *s1,const char *s2,int n) +BOOL strnequal(char *s1,char *s2,int n) { if (s1 == s2) return(True); if (!s1 || !s2 || !n) return(False); @@ -3923,7 +3923,7 @@ void file_unlock(int fd) is the name specified one of my netbios names returns true is it is equal, false otherwise ********************************************************************/ -BOOL is_myname(const char *s) +BOOL is_myname(char *s) { int n; BOOL ret = False; |