summaryrefslogtreecommitdiff
path: root/source3/lib/util.c
AgeCommit message (Collapse)AuthorFilesLines
1998-12-04- renamed do_samr_xxx to samr_xxxLuke Leighton1-4/+4
- renamed do_lsa_xxx to lsa_xxx - added "enumgroups [-m]" command, enumerates groups, shows members. - added cmd_sam_add_groupmem(), need to call these in rpcclient.c - added cmd_sam_add_aliasmem(), need to call these in rpcclient.c - modified "enumaliases [-m]" command - improved "enumgroups" and "enumaliases" to display names not just RIDS/SIDs. - renamed "samr_unknown_12" to "samr_lookup_rids". - added the following client-side functions: get_samr_query_groupmem() get_samr_query_aliasmem() get_samr_query_groupinfo() samr_enum_dom_groups() samr_enum_dom_aliases() samr_add_aliasmem() samr_add_groupmem() - improved display output (display.c) (This used to be commit eacc5e581af2b4de24186b9be3238b352c54effe)
1998-12-03moved get_unixgroups it will be needed by the unix instance of the groupLuke Leighton1-0/+49
DB API (This used to be commit ef58e48bc9af338ed6c734205d4faf82371284ac)
1998-12-01adding some samr parsing calls (group / alias adding / deleting)Luke Leighton1-0/+15
added code that moves MACHINE.SID to DOMAIN_NAME.SID if it exists. (This used to be commit 51c1c31768a92d9c57ee6c09b78419bcbc544f03)
1998-11-29weekend work. user / group database API.Luke Leighton1-43/+60
- split sam_passwd and smb_passwd into separate higher-order function tables - renamed struct smb_passwd's "smb_user" to "unix_user". added "nt_user" plus user_rid, and added a "wrap" function in both sam_passwd and smb_passwd password databases to fill in the blank entries that are not obtained from whatever password database API instance is being used. NOTE: whenever a struct smb_passwd or struct sam_passwd is used, it MUST be initialised with pwdb_sam_init() or pwd_smb_init(), see chgpasswd.c for the only example outside of the password database APIs i could find. - added query_useraliases code to rpcclient. - dealt with some nasty interdependencies involving non-smbd programs and the password database API. this is still not satisfactorily resolved completelely, but it's the best i can do for now. - #ifdef'd out some password database options so that people don't mistakenly set them unless they recompile to _use_ those options. lots of debugging done, it's still not finished. the unix/NT uid/gid and user-rid/group-rid issues are better, but not perfect. the "BUILTIN" domain is still missing: users cannot be added to "BUILTIN" groups yet, as we only have an "alias" db API and a "group" db API but not "builtin-alias" db API... (This used to be commit 5d5d7e4de7d1514ab87b07ede629de8aa00519a1)
1998-11-25Makefile.in: Added maintainer mode fixes.Jeremy Allison1-179/+20
aclocal.m4: Added AC_LIBTESTFUNC. configure.in: Fixed -lsecurity -lsec problems. client.c: dos_ fixes. groupdb/aliasunix.c: Dead code removal. include/includes.h: Added default PRINTCAP_NAME. lib/genrand.c: dos_ fixes. lib/replace.c: Added strtoul. lib/system.c: dos_ fixes. lib/util.c: dos_ fixes. lib/util_sid.c: Signed/unsigned fixes. lib/util_str.c: removed bad const. locking/locking_slow.c: dos_ fixes. printing/printing.c: dos_ fixes. rpc_server/srv_samr.c: Dead code removal. rpc_server/srv_sid.c: global_myworkgroup defined with wrong size AGAIN ! smbd/dir.c: dos_ fixes. smbd/open.c: dos_ fixes. smbd/oplock.c: dos_ fixes. smbd/reply.c smbd/server.c smbd/service.c smbd/uid.c: dos_ fixes. Jeremy. (This used to be commit 6acb4b68f68d516e2ac3c47e500f5600d653435e)
1998-11-23unix instance of group database APILuke Leighton1-4/+13
(This used to be commit e76f593b3572ac881f1aa1fb3326d8b7169b0078)
1998-11-17Added the same open()/fopen()/creat()/mmap() -> sys_XXX calls.Jeremy Allison1-3/+3
Tidied up some of the mess (no other word for it). Still doesn't compile cleanly. There are calls with incorrect parameters that don't seem to be doing the right thing. This code still needs surgery :-(. Jeremy. (This used to be commit 18ff93a9abbf68ee8c59c0af3e57c63e4a015dac)
1998-11-17- group database API. oops and oh dear, the threat has been carried out:Luke Leighton1-1/+21
the pre-alpha "domain group" etc parameters have disappeared. - interactive debug detection - re-added mem_man (andrew's memory management, detects memory corruption) - american spellings of "initialise" replaced with english spelling of "initialise". - started on "lookup_name()" and "lookup_sid()" functions. proper ones. - moved lots of functions around. created some modules of commonly used code. e.g the password file locking code, which is used in groupfile.c and aliasfile.c and smbpass.c - moved RID_TYPE_MASK up another bit. this is really unfortunate, but there is no other "fast" way to identify users from groups from aliases. i do not believe that this code saves us anything (the multipliers) and puts us at a disadvantage (reduces the useable rid space). the designers of NT aren't silly: if they can get away with a user- interface-speed LsaLookupNames / LsaLookupSids, then so can we. i spoke with isaac at the cifs conference, the only time for example that they do a security context check is on file create. certainly not on individual file reads / writes, which would drastically hit their performance and ours, too. - renamed myworkgroup to global_sam_name, amongst other things, when used in the rpc code. there is also a global_member_name, as we are always responsible for a SAM database, the scope of which is limited by the role of the machine (e.g if a member of a workgroup, your SAM is for _local_ logins only, and its name is the name of your server. you even still have a SID. see LsaQueryInfoPolicy, levels 3 and 5). - updated functionality of groupname.c to be able to cope with names like DOMAIN\group and SERVER\alias. used this code to be able to do aliases as well as groups. this code may actually be better off being used in username mapping, too. - created a connect to serverlist function in clientgen.c and used it in password.c - initialisation in server.c depends on the role of the server. well, it does now. - rpctorture. smbtorture. EXERCISE EXTREME CAUTION. (This used to be commit 0d21e1e6090b933f396c764af535ca3388a562db)
1998-11-12extracted the password change code from smbpasswd and used it in swatAndrew Tridgell1-0/+53
instead of opening pipes and other horrible stuff. (This used to be commit 49bf19710345a59a2d17cd449be1a132885ed821)
1998-11-12largely rewrote smbpasswd so that the code is understandable. ThisAndrew Tridgell1-1/+1
should allow us to call a function in swat rather than piping to smbpasswd. while doing this I also fixed quite a few "const char *" versus "char *" issues that cropped up while using const to track down bugs in the code. This led to changes in several generic functions. The smbpasswd changes should be correct but they have not been extensively tested. At least if I have introduced bugs then we should be able to fix them more easily than before. (This used to be commit 713864dd0322ae2ae2d83e333d85be35a7eed4ec)
1998-11-11changed syntax of registry commands so keys can start with HKLM or HKU.Luke Leighton1-13/+55
sorted lookupsids command (This used to be commit 13a0ee851fe0ce9acddfe57f9aba19fc78085c39)
1998-11-10util functions split into relevant modules, first pass.Luke Leighton1-1992/+99
(This used to be commit d448906e68cec5019fa83f7d31b862efff41e2da)
1998-11-09Makefile.in: Removed rpc_server/srv_ldap_helpers.c per J.F.'s instructions.Jeremy Allison1-1/+1
client/client.c: client/clitar.c: include/client.h: smbwrapper/smbw_dir.c: smbwrapper/smbw_stat.c: smbwrapper/smbw.c: lib/util.c: Converted all use of 'mode' to uint16. smbd/quotas.c: Fixed stupid comment bug I put in there :-(. printing/printing.c: Fix from J.F. to new code. Jeremy. (This used to be commit bacd3e9d2036a804e73644a28fc498f229c8446c)
1998-10-28use abort() instead of exit() in smb_panic()Andrew Tridgell1-1/+1
the reason we don't return() here is that smb_panic() is used not just for segv but also for detected errors (such as buffer overflows) (This used to be commit 7a50ca81a5842f7139e67c0ff9de79518599f445)
1998-10-23include/smb.h: Added #defines for lots of things - makes our code a *lot* ↵Jeremy Allison1-1/+1
easier to read. lib/util.c: Fixed Luke's set_first_token() function - should return void. smbd/close.c: Move delete_on_close into file_fd_struct structure. smbd/ipc.c: Changed local_machine back to fstring. smbd/nttrans.c: Use defines for mapping share modes. smbd/open.c: Move delete_on_close into file_fd_struct structure, added code for ALLOW_SHARE_DELETE. smbd/reply.c: Use defines for mapping share modes. smbd/trans2.c: Move delete_on_close into file_fd_struct structure. Jeremy. (This used to be commit 8e1ce307bd6a9056b4a95fe6f52ff42dc6e03a08)
1998-10-22rpctorture commandLuke Leighton1-0/+5
(This used to be commit b4ae65e2d0582274d67d02ea190f6d3d83b48594)
1998-10-20Fixed bug found by John Blair where trim_string wasn'tJeremy Allison1-7/+89
correctly trimming trailing multibyte code page strings. Jeremy. (This used to be commit dbdbce29f56d03f6abf1ee3d96ca2032e688dcbc)
1998-10-20some quite important bug-fixes i missed because i transferred the wrongLuke Leighton1-1/+3
smb.tgz file from my portable. particularly the call to mem_data followed by a realloc of that data in cli_pipe.c's rpc_read() function. smbd responses now use p->rdata_i which is a faked-up pointer into p->rdata's response data. rdata can be very long; rdata_i is limited to point to no more than max_tsize - 0x18 in length. this will make it an almost trivial task to add the encrypted rpc headers after rdata_i, and mem_buf_copy will cope admirably with rhdr chained to rdata_i chained to auth_verifier etc etc... (This used to be commit 05a297e3a98c14360782af4ad0d851638fb5da9a)
1998-10-19- dce/rpc codeLuke Leighton1-16/+4
- removed debug info in struni2 and unistr2 (security risk) - rpc_pipe function was getting pointer to data then calling realloc *dur* - password check function, the start of "credential checking", user, wks, domain, pass as the credentials (not just user,pass which is incorrect in a domain context) - cli_write needs to return ssize_t not size_t, because total can be -1 if the write fails. - fixed signed / unsigned warnings (how come i don't get those any more when i compile with gcc???) - nt password change added in smbd. yes, jeremy, i verified that the SMBtrans2 version still works. (This used to be commit fcfb40d2b0fc565ee4f66b3a3761c246366a2ef3)
1998-10-19removed an incorrect commentAndrew Tridgell1-4/+0
(This used to be commit 5abdb70e2a5cda2df444dfe5a9cdcb751be75ca8)
1998-10-18Fixed sys_lseek and seek_file calls so all returnsJeremy Allison1-2/+3
are *checked* :-). Jeremy. (This used to be commit b8b781191dd7d28944d87eec5fa0fbef798e289b)
1998-10-16Re-added code to tell the user how many open files theyJeremy Allison1-5/+7
have. Needed for server diagnosis purposes... Jeremy. (This used to be commit 04d79a9ae515e7259277f9980552f1d61df239f1)
1998-10-05- fixed cast warningsAndrew Tridgell1-11/+13
- ignore *.po32 files (This used to be commit 469474803d39ceec7155792d364787318708fb91)
1998-10-05added a function set_maxfiles() to set our file rlimit to the maxAndrew Tridgell1-0/+23
possible and return the max. (This used to be commit 7a7b5ee1689b6be57752d176c7b77a2f1b453486)
1998-10-04more solaris 2.5 fixups. It now seems to be working pretty well.Andrew Tridgell1-0/+1
(This used to be commit c4e450817886b40474cebdfc50c0c16fb4646baf)
1998-10-04use *SMBSERVER convention in smbwrapper to allow us to connect toAndrew Tridgell1-1/+1
servers that we don't know the netbios name of. (This used to be commit 147d49dade3901835b5d60b02c495bea544ff5e9)
1998-10-04added support for printing via smbwrapperAndrew Tridgell1-1/+11
You can print using "cp filename /smb/SERVER/PRINTER/jobname" You can list the current printqueue using ls (This used to be commit 080fb61b69620e26e8122705383dc2bd0468a519)
1998-10-03added simple device/inode number support based on a checksum of theAndrew Tridgell1-1/+1
filename (This used to be commit 5674fb4e9dc4d92213d763c8cecd26efc23a9720)
1998-10-03fixed a bug in name_len() (thanks to kooros@kooros.netrack.net)Andrew Tridgell1-7/+7
(This used to be commit f05f0a01cefbf19943a53c3307eb992d77238b51)
1998-10-03added unlink() and rename() support to smbwrapperAndrew Tridgell1-1/+1
(This used to be commit b85d96144728e8a29c7c1114462e28bf3b144b80)
1998-10-03- ignore *.p filesAndrew Tridgell1-1/+1
- make msleep() non-static (This used to be commit 688a749484aa807075d2ce16d750c4f3494f3e55)
1998-09-29Got very strict about the differences and uses ofJeremy Allison1-5/+9
uid_t, gid_t and vuid. Added sys_getgroups() to get around the int * return problem. Set correct datatypes for all uid, gid and vuid variables. Jeremy. (This used to be commit e570db46fc3a78e499523fd342e9a34cebb18998)
1998-09-28Fixed problems found in lint pass over the old code by <cpeterso@microsoft.com>.Jeremy Allison1-4/+7
These were the problems that still existed in the 2.0 branch. Jeremy. (This used to be commit 3fd28812f75f2311a114ff905143634e3bbb1fac)
1998-09-28Changes to test in configure if capabilities are enabled on a system.Jeremy Allison1-2/+2
Changes to get Samba to compile cleanly with the IRIX compiler with the options : -fullwarn -woff 1209,1174 (the -woff options are to turn off warnings about unused function parameters and controlling loop expressions being constants). Split prototype generation as we hit a limit in IRIX nawk. Removed "." code in smbd/filename.c (yet again :-). Jeremy. (This used to be commit e0567433bd72aec17bf5a54cc292701095d25f09)
1998-09-25Makefile.in: Fixed bug with continuation line causing proto to fail.Jeremy Allison1-0/+13
Added $(PROGS) $(SPROGS) as targets for make clean. acconfig.h: Added HAVE_IRIX_SPECIFIC_CAPABILITIES. configure.in: Added sys/capability.h header check. Added function checks for srandom random srand rand. Added HAVE_IRIX_SPECIFIC_CAPABILITIES test. includes.h: Added #include <sys/capability.h>. ntdomain.h: Moved struct acct_info into here from smb.h smb.h: Added KERNEL_OPLOCK_CAPABILITY define. Moved enum action_type into rpcclient.h Moved struct cli_state into client.h Moved struct nt_client_info, struct tar_client_info, struct client_info into rpcclient.h lib/genrand.c: Changed to use sys_random() & friends. lib/smbrun.c: Lose capabilities after fork. lib/system.c: Added set_process_capability(), set_inherited_process_capability() sys_random(), sys_srandom(). lib/util.c: Added Ander's EFBIG lock check to fcntl_lock for 64 bit access to an 32 bit mounted NFS filesystem. nmbd/nmbd.c: Changed to use sys_random() & friends. nmbd/nmbd_browsesync.c: Changed to use sys_random() & friends. passdb/ldap.c: Missed one pdb_encode_acct_ctrl call. passdb/passdb.c: Changed to Ander's code for ' ' characters. passdb/smbpass.c: Added Ander's code to reset ACB_PWNOTREQ. script/mkproto.awk: Added 'long' to prototypes. smbd/chgpasswd.c: Lose capabilities after fork. smbd/open.c: Do the mmap *after* the kernel oplock. smbd/oplock.c: Removed stub code from kernel oplock path. Added set_process_capability(), set_inherited_process_capability() calls. smbd/reply.c: Initialize count = 0, offset = 0. smbd/server.c: Added set_process_capability(), set_inherited_process_capability() calls. tests/summary.c: Ensure we have RANDOM or RAND. utils/smbpasswd.c: Added Ander's code to reset ACB_PWNOTREQ. utils/torture.c: Changed to use sys_random() & friends. Jeremy. (This used to be commit e8be306f23963ac00b1a383ebe0cc1421529fb02)
1998-09-25added rpcclient programLuke Leighton1-0/+40
(This used to be commit aa38f39d67fade4dfd7badb7a9b39c833a1dd1ca)
1998-09-23First cut at kernel oplocks. This should have no effect unless runninJeremy Allison1-218/+0
on a machine that supports them in autoconf. Move various functions out of lib/util.c into smbd/process.c and smbd/oplock.c where they belong. Jeremy. (This used to be commit c3c5e13f85c97939746070132dad941e79c546fb)
1998-09-19Remove some byte-copying code in unix_format() that did nothing exceptJeremy Allison1-8/+0
slow down my benchmark :-). Jeremy. (This used to be commit b55f93b213ee61c35e7a87a2be63191d55186bd6)
1998-09-18got rid of some #ifdef LARGE_XXXX stuff and got rid of non-portable LLAndrew Tridgell1-15/+4
suffix from some constants. (This used to be commit 84956eddf32aa66c787ec76bdb60d2843fa7a025)
1998-09-17configure configure.in: Added checks for statvfs64. Last bit of 64 bit ↵Jeremy Allison1-3/+3
widening (I hope :-). include/config.h.in: Added #undef STAT_STATVFS64. include/includes.h: Added SMB_STRUCT_STATVFS type, Changed SMB_BIG_INTEGER to SMB_BIG_UINT and SMB_BIG_INT types. include/smb.h: Added flag defines from CIFS spec. lib/debug.c: Fixed one more mode_t issue. lib/system.c: Added sys_statvfs wrapper. lib/util.c: Changed trim_string to use size_t. param/loadparm.c: Moved "blocking locks" into locking section. Alphabetised locking options. Question - shuld we do this for all options ? passdb/ldap.c: Changed SMB_BIG_INTEGER to SMB_BIG_UINT. passdb/nispass.c: Changed SMB_BIG_INTEGER to SMB_BIG_UINT. passdb/smbpass.c: Changed SMB_BIG_INTEGER to SMB_BIG_UINT. smbd/dfree.c: Changed to use 64 bit types if available. Moved to use unsigned types. smbd/dosmode.c: Fixed one more mode_t issue. smbd/negprot.c: Changed literals to be FLAG_ #defines. smbd/nttrans.c: Removed dead code. smbd/open.c: Changed disk_free call. smbd/process.c: Changed literals to be FLAG_ #defines. smbd/reply.c: Changed disk_free call. smbd/trans2.c: Fixed but in SMB_QUERY_FS_VOLUME_INFO call. Was using UNICODE - should use ascii. tests/summary.c: Added STAT_STATVFS64 check. Jeremy. (This used to be commit c512b1b91fb7f2a7a93b9033a33e06d966daadb4)
1998-09-15Removed hideous inefficiencies in old trim_string code. This was makingJeremy Allison1-15/+22
calls to strlen() a profiling hotspot. Jeremy. (This used to be commit ffa450acddb7aec6a440ae3fe6032c109805d176)
1998-09-11Added ssize_t to configure code.Jeremy Allison1-102/+105
Got 'religion' about using size_t and ssize_t for read/write stuff as part of the code to expose 64 bits to the client. This checkin does all the 'easy' stuff - such as all the read/write/lock calls - but now comes the harder parts (open & friends) and all the file enquiry functions..... Jeremy. (This used to be commit 36544fe5476f7770bd5748574fc54be7b3ee4d4a)
1998-09-05ahh, the joy of deleting large chunks of code that someone else hasAndrew Tridgell1-13/+0
painstakingly put in :) This gets rid of most of the #ifdef LARGE_SMB_INO_T ifdefs around DEBUG() statements. We just use %.0f in all cases. Makes the code a bit easier to read :) (This used to be commit 41f0069afc02169932e04ff0039bb6328eaaf04d)
1998-09-05tridge the destroyer returns!Andrew Tridgell1-168/+30
prompted by the interpret_security() dead code that Jean-Francois pointed out I added a make target "finddead" that finds potentially dead (ie. unused) code. It spat out 304 function names ... I went through these are deleted many of them, making others static (finddead also reports functions that are used only in the local file). in doing this I have almost certainly deleted some useful code. I may have even prevented compilation with some compile options. I apologise. I decided it was better to get rid of this code now and add back the one or two functions that are needed than to keep all this baggage. So, if I have done a bit too much "destroying" then let me know. Keep the swearing to a minimum :) One bit I didn't do is the ubibt code. Chris, can you look at that? Heaps of unused functions there. Can they be made static? (This used to be commit 2204475c87f3024ea8fd1fbd7385b2def617a46f)
1998-09-05got rid of interpret_security(). Thanks to Jean-Francois for pointingAndrew Tridgell1-17/+0
out it is no longer used (replaced by enumerated types in loadparm.c) (This used to be commit 88df8a8b25921389ee9d017b770bbae143cc51b8)
1998-09-04More 64 bit stuff - now the fcntl locks are 64 bit clean.Jeremy Allison1-51/+61
Nearly at the stage where I can expose the 64-bit-ness to the NT clients.... Jeremy. (This used to be commit 422f1dd45074c0e28203aca5952e57bbe56676b6)
1998-09-03Ok - this is the 64 bit widening check in. It changes the configureJeremy Allison1-55/+59
to check for stat64 and friends, and then changes much of Samba to use the data type SMB_OFF_T for file size information. stat/fstat/lstat/lseek/ftruncate have now become sys_stat etc. to hide the 64 bit calls if needed. Note that this still does not expose 64 bit functionality to the client, as the changes to the reply_xxx smb's are not yet done. This code change should make these changes possible. Still to do before full 64 bit-ness to the client: fcntl lock code. statfs code widening of dev_t and ino_t (now possible due to SMB_DEV_T and SMB_OFF_T types being in place). Let me know if wierd things happen after this check-in and I'll fix them :-). Jeremy. (This used to be commit 14500936c321d15995c963766aac67bf1f4e3824)
1998-09-02we are never interested in SIGPIPE so just ignore (block) itAndrew Tridgell1-9/+0
always. Don't even install a handler. (This used to be commit 72c383f4b7bcce5374632dc972df16ab0e2542b9)
1998-09-01More abstraction of file system data types, to move to a 64Jeremy Allison1-13/+13
bit file interface for the NT SMB's. Created a new define, SMB_STRUCT_STAT that currently is defined to be struct stat - this wil change to a user defined type containing 64 bit info when the correct wrappers are written for 64 bit stat(), fstat() and lstat() calls. Also changed all sys_xxxx() calls that were previously just wrappers to the same call prefixed by a dos_to_unix() call into dos_xxxx() calls. This makes it explicit when a pathname translation is being done, and when it is not. Now, all sys_xxx() calls are meant to be wrappers to mask OS differences, and not silently converting filenames on the fly. Jeremy. (This used to be commit 28aa182dbffaa4ffd86047e608400de4b26e80eb)
1998-08-31configure.in, configure: include/config.h.in: Added stropts and poll.Jeremy Allison1-46/+47
include/smb.h: Moved old typedefs of uint8 etc. into include/includes.h where all the other defines live (changed them from typedefs to defines). Other changes : changed from using uint32 to SMB_DEV_T and SMB_INO_T in preparation for moving to size independed (ie. 64 bit clean) device and inode access. Stat call wrapper comes next :-). Jeremy. (This used to be commit 3d9ec96de5e04e83abafe9c5d980bd39eee856ea)