summaryrefslogtreecommitdiff
path: root/source3/lib/util.c
AgeCommit message (Collapse)AuthorFilesLines
2001-10-03switched over to a new method of handling uppercase/lowercase mappingsAndrew Tridgell1-0/+10
for unicode strings. The new method relies on 3 files that are mmap'd at startup to provide the mapping tables. The upcase.dat and lowcase.dat tables should be the same on all systems. The valid.dat table says what characters are valid in 8.3 names, and differs between systems. I'm committing the japanese valid.dat here, in future we need some way of automatically installing and choosing a appropriate table. This commit also adds my mini tdb based gettext replacement in intl/lang_tdb.c. I have not enabled this yet and have not removed the old gettext code as the new code is still being looked at by Monyo. Right now the code assumes that the upcase.dat, lowcase.dat and valid.dat files are installed in the Samba lib directory. That is not a good choice, but I'll leave them there until we work out the new install directory structure for Samba 3.0. simo - please look at the isvalid_w() function and think about using it in your new mangling code. That should be the final step to correctly passing the chargen test code from monyo. (This used to be commit 1c221994f118dd542a158b2db51e07d04d0e9314)
2001-10-02Fixed up the change password bug when not using PAM.Jeremy Allison1-4/+116
The problem is we were trying to use mask_match as a generic wildcard matcher for UNIX strings (like the password prompts). We can't do that - we need a unix_wild_match (re-added into lib/util.c) as the ms_fnmatch semantics for empty strings are completely wrong. This caused partial reads to be accepted as correct passwd change responses when they were not.... Also added paranioa test to stop passwd change being done as root with no %u in the passwd program string. Jeremy. (This used to be commit 9333bbeb7627c8b21a3eaeae1683c34e17d14bf0)
2001-10-02Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header.Tim Potter1-2/+0
(This used to be commit 2d0922b0eabfdc0aaf1d0797482fef47ed7fde8e)
2001-09-26OpenSSL merge from 2.2Gerald Carter1-1/+1
(This used to be commit efc6df5a3914da9e7b792ccaccd1403c72c09f78)
2001-09-17fixed ctemp in server and client. It turns out that ctemp on NT is ↵Andrew Tridgell1-3/+4
completely broken, and it's pointless to emulate their brokenness completely in this case, but at least this makes us use approximately the same packet format. The spec is complelet wrong in this case (This used to be commit 2d507ec669def6d49304559e53d6c14af9b290a9)
2001-09-17move to SAFE_FREE()Simo Sorce1-14/+10
(This used to be commit 60e907b7e8e1c008463a88ed2b076344278986ef)
2001-09-10replaced stdio in many parts of samba with a XFILE. XFILE is a cut-downAndrew Tridgell1-10/+0
replacemnt of stdio that doesn't suffer from the 8-bit filedescriptor limit that we hit with nasty consequences on some systems I would eventually prefer us to have a configure test to see if we need to replace stdio, but for now this code needs to be tested widely so I'm enabling it by default. (This used to be commit 1af8bf34f1caa3e7ec312d8109c07d32a945a448)
2001-09-04Merge of transfer file code from 2.2, fix for readbraw.Jeremy Allison1-66/+39
Jeremy. (This used to be commit c05e79453655abb67fd47a2d3dba88b4c5377e35)
2001-09-04Fixed some compiler warnings.Tim Potter1-2/+0
(This used to be commit 06608971ed95c02188a1b2bf7b1f9a2845e04022)
2001-08-20a bunch of fixes from the sflight to seattleAndrew Tridgell1-3/+6
in particular: - fixed NT status code for a bunch of ops - fixed handling of protocol levels in ms_fnmatch (This used to be commit 3eba9606f71f90bfd9820af26f8676277ed22390)
2001-08-12this is a big global fix for the ptr = Realloc(ptr, size) bug.Simo Sorce1-2/+6
many possible mem leaks, and segfaults fixed. someone should port this fix to 2.2 also. (This used to be commit fa8e55b8b465114ce209344965c1ca0333b84db9)
2001-08-05me stupid.Simo Sorce1-1/+1
never commit without building. sorry. (This used to be commit f87924aec4ff3ad1855b470c33df2e0ae9d51d85)
2001-08-05Some fixes about malloc/Realloc and mem leakSimo Sorce1-1/+1
thanks to andreas moroder (This used to be commit b29a549cdd85d42a1697041ab04f0ae4eddd23ca)
2001-07-25need to push smb_search strings in client charsetAndrew Tridgell1-5/+5
(This used to be commit df00e5dceae91f6ffca77704c4517b91fd796d32)
2001-07-23Fix case insensitive password change code.Jeremy Allison1-0/+13
Fixed crash bug with un-zeroed talloced memory. Jeremy. (This used to be commit eea1c30df246e081e672d7132345d0fd35ad9841)
2001-07-07Add backend encryption support for NTLMv2.Andrew Bartlett1-3/+3
The leg-work for this was done by the folks at samba-tng.org, I'm just bringing it accross to HEAD. The MD5 implementation is seperatly derived, and does not have the copyright problems that the one in TNG has. Also add const to a few places where it makes sence. Andrew Bartlett (This used to be commit 8df8e841445dfe09fc7a06bb55d12adc3fecb345)
2001-07-04strchr and strrchr are macros when compiling with optimisation in gcc, so we ↵Andrew Tridgell1-10/+10
can't redefine them. damn. (This used to be commit c41fc06376d1a2b83690612304e85010b5e5f3cf)
2001-07-04The big character set handling changeover!Andrew Tridgell1-17/+2
This commit gets rid of all our old codepage handling and replaces it with iconv. All internal strings in Samba are now in "unix" charset, which may be multi-byte. See internals.doc and my posting to samba-technical for a more complete explanation. (This used to be commit debb471267960e56005a741817ebd227ecfc512a)
2001-06-25Ensure numeric group or user names don't get misinterpreted.Jeremy Allison1-4/+8
Jeremy. (This used to be commit e88da9dcc79801028127bcbe328af001b58e653a)
2001-06-21next_token() was supposed to be a reentrant replacement for strtok(),Andrew Tridgell1-1/+1
but the code suffered from bitrot and is not now reentrant. That means we can get bizarre behaviour i've fixed this by making next_token() reentrant and creating a next_token_nr() that is a small non-reentrant wrapper for those lumps of code (mostly smbclient) that have come to rely on the non-reentrant behaviour (This used to be commit 674ee2f1d12b0afc164a9e9072758fd1c5e54df7)
2001-06-18Removed silly Get_Hostbyname() wrapper as DNS names are case-insensitiveTim Potter1-65/+4
and the use of this function only increased timeouts when Samba queries a broken DNS server. (This used to be commit 720fea53603b2f99153709e6717ca930ab60ca9f)
2001-05-07removed need for scandir in client.cAndrew Tridgell1-1/+3
fixed possible bug with readdirname on systems with NAMELEN != strlen (This used to be commit 78f448b7d4b83f569d27e0abf6b1759c43ff21f3)
2001-04-18Removed mktemp from HEAD - same as done in 2.2.Jeremy Allison1-39/+4
Jeremy. (This used to be commit 121b59669fbcd1aaedb08011ff36169fc6561c55)
2001-04-13Added fix from "Eric Boehm" <boehm@nortelnetworks.com> to try and set hardJeremy Allison1-0/+24
limit before setting soft limit. Jeremy. (This used to be commit a1eb2752a8bee9cc7d92c664c3de84e02620933d)
2001-04-13As Andrew suggested, make smbrun return a fd for a deleted file which can thenJeremy Allison1-2/+3
be read. Jeremy. (This used to be commit e7d59d6de89a5fdd201e4b5c6072dab08b1519db)
2001-04-11To stop people complaining about the mktemp call, move it into lib/util.c. ↵Jeremy Allison1-0/+14
Thanks to Andrew for all this code. Fixed extra line in lib/sysacls.c that broke XFS ACL code. Jeremy. (This used to be commit 9b32b8a8cfc8ddb93c14d5581f433d2e93f89ed2)
2001-04-10Fixed --with-automount compile error.Jeremy Allison1-2/+2
Jeremy. (This used to be commit ab916199f542528293b3f63fe6f24eecd83eccb4)
2001-04-08Got "medieval on our ass" about adding the -1 to slprintf.Jeremy Allison1-1/+1
Jeremy. (This used to be commit 94747b4639ed9b19f7d0fb896e43aa392a84989a)
2001-03-26Patch to make automount lookup fallback to get home directory from getpwnam.Jeremy Allison1-19/+25
From Robert Montjoy <Rob_Montjoy@ECECS.UC.EDU>. Jeremy. (This used to be commit 1fe60064bddf29fd778918d3f1a7026002029bd7)
2001-03-11Merge of new 2.2 code into HEAD (Gerald I hate you :-) :-). Allows new SAMRJeremy Allison1-1/+1
RPC code to merge with new passdb code. Currently rpcclient doesn't compile. I'm working on it... Jeremy. (This used to be commit 0be41d5158ea4e645e93e8cd30617c038416e549)
2001-03-10started support for unicode on the wire in smbd. Using a very similarAndrew Tridgell1-0/+9
method to what was used in the client I now have session setup and tconx working. Currently this is enabled with SMBD_USE_UNICODE environment variable. Once the code is complete this will become a smb.conf option. (This used to be commit 7684c1e67294266d018c6f0cab58f1a9d797174f)
2001-02-20- neater setting of bccAndrew Tridgell1-6/+16
- converted cli_rename and cli_unlink (This used to be commit 0a8992e224b7a3d90d45b13d73fa8a6f155efa79)
2000-11-16Ok - fixed a bug in our levelII oplock code. We need to break a level II onJeremy Allison1-51/+0
a byte range lock (write lock only, but Win2k breaks on read lock also so I do the same) - if you think about why, this is obvious. Also fixed our client code to do level II oplocks, if requested, and fixed the code where we would assume the client wanted level II if it advertised itself as being level II capable - it may not want that. Jeremy. (This used to be commit 213cd0b5192307cd4b0026cae94b2f52fb1b0c02)
2000-10-13Fix to allow smbd to call winbindd if it is running for all group enumeration,Jeremy Allison1-15/+35
falling back to the UNIX calls on error. This should fix all problems with smbd enumerating all users in all groups in all trusted domains via winbindd. Also changed GETDC to query 1C name rather than 1b name as only the PDC registers 1b. Jeremy. (This used to be commit 5b0038a2afd8abbd6fd4a58f5477a40d1926d498)
2000-09-27Restructuring of the code to remove dos_ChDir/dos_GetWd and re-vector themJeremy Allison1-131/+0
through the VFS. All file access/directory access code in smbd should now go via the vfs. Added vfs_chown/vfs_chmod calls. Still looking at vfs_get_nt_acl() vfs_set_nt_acl() call API design. Jeremy. (This used to be commit f96625ec124adb6e110dc54632e006b3620a962b)
2000-06-11Linux kernel oplocks now seem to work, but need a _lot_ of testingAndrew Tridgell1-1/+1
I had to modify sys_select() to not loop on EINTR. I added a wrapper called sys_select_intr() which gives the old behaviour. (This used to be commit b28cc4163bc2faaa80c5782fc02c8f03c410cdeb)
2000-05-17Changed name of case_sensitive in mask_match to avaid gcc "shadow global"Jeremy Allison1-4/+2
warning. Jeremy. (This used to be commit 36629d2a934fe61e68f87c5d2faf67158b365ae6)
2000-05-02Moved uglyness needed in fcntl locking (64->32 bit mapping, NFSJeremy Allison1-102/+6
errors etc.) into locking/posix.c, where it is needed. fcntl_lock in lib/util.c is now very small and clean. Added (*lock) op to vfs layer. Jeremy. (This used to be commit 46092ee1410faa4e3c143d80a960a8adaa19d7fc)
2000-05-02Added sys_fork() and sys_getpid() functions to stop the overheadJeremy Allison1-3/+3
of doing a system call every time we want to just get our pid. Jeremy. (This used to be commit 148628b616b5c29ba6340d65fc3ddbcabba6e67a)
2000-04-30- removed all our old wildcard matching code and replaced it with aAndrew Tridgell1-604/+53
call to ms_fnmatch(). This also removes all the Win9X semantics stuff and a bunch of other associated cruft. - moved the stat cache code into statcache.c - fixed the uint16 alignment requirements of ascii_to_unistr() and unistr_to_ascii() - trans2 SMB_FIND_FILE_BOTH_DIRECTORY_INFO returns the short name as unicode always (at least thats what NT4 does) - fixed some errors in the in-memory tdb code. Still ugly, but doesn't crash as much (This used to be commit 03e9cea004bbba72161a5323cf3b4556c94aed8e)
2000-04-30YIPEE!!!!!Andrew Tridgell1-1/+1
We finally have a perfect emulation of Microsoft wildcard matching. The routine ms_fnmatch() does wildcard matching with all MS wildcards (including the unicode wildcards), and masktest against a NT4 workstation with hundreds of thousands of random exmaples has not found a single error. amazingly it is only about 60 lines of code, but it has taken us years to get it right. I didn't sleep much last night :) (This used to be commit cc9e007cdfdd300189f89e2a55e4234e47fa842d)
2000-04-24moved the INSURE hook into util.cAndrew Tridgell1-0/+26
(This used to be commit 8c726b9764bac0bc95cf9877e172c9e1262e576d)
2000-04-23if using insure then don't close fd 2Andrew Tridgell1-1/+4
(This used to be commit 1c6322473afcf9065fa25777d1b0627f133af3f6)
2000-04-22return NULL for a zero size memdupAndrew Tridgell1-0/+1
(This used to be commit 9416b58b9c2ff898cdae2cb81ab1e150ef9f0e89)
2000-04-17moved standard_sub() and friends into a separate moduleAndrew Tridgell1-269/+1
(This used to be commit 030ec8e71f9ef533b5d6aece01e67d357e23b7d2)
2000-04-15added standard_sub_snum() function for modules that don't haveAndrew Tridgell1-1/+8
a connection structure (This used to be commit f35fe3b4a175161128341fe30a61437c560180d1)
2000-04-12Removed "ole locking compat" parameter (no longer used).Jeremy Allison1-34/+1
We now get/set/check POSIX locks, but I still need to code up the close fd braindamage... Jeremy. (This used to be commit 3de058bd43976853b0ed2b6b5529e2a3a08909eb)
2000-04-11include/byteorder.h: ALIGN4/ALIGN2 macros.Jeremy Allison1-25/+0
include/includes.h: Added SMB_BIG_UINT_BITS. lib/util.c: Removed align2/align4 - use macros. libsmb/namequery.c: Use ALIGN2. locking/locking.c: Replace do_lock, do_unlock, args with SMB_BIG_UINT, not SMB_OFF_T. Needed to move to hiding POSIX locks at a lower layer. nmbd/nmbd_processlogon.c: Use ALIGN2/ALIGN4 macros. smbd/blocking.c: Replace do_lock, do_unlock, args with SMB_BIG_UINT, not SMB_OFF_T. smbd/reply.c: Replace do_lock, do_unlock, args with SMB_BIG_UINT, not SMB_OFF_T. Jeremy. (This used to be commit 491eea8a20bf80d426625479326211dc975857a6)
2000-04-11add an align4() functionAndrew Tridgell1-1/+14
(This used to be commit 7969f4dccbc5a506ef58b9270a08f8f70d9006f7)
2000-04-11finally got sick of the "extern int Client" code and the stupidAndrew Tridgell1-51/+2
assumption that we have one socket everywhere while doing so I discovered a few bugs! 1) the clientgen session retarget code if used from smbd or nmbd would cause a crash as it called close_sockets() which closed our main socket! fixed by removing close_sockets() completely - it is unnecessary 2) the caching in client_addr() and client_name() was bogus - it could easily get fooled and give the wrong result. fixed. 3) the retarget could could recurse, allowing an easy denial of service attack on nmbd. fixed. (This used to be commit 5937ab14d222696e40a3fc6f0e6a536f2d7305d3)