summaryrefslogtreecommitdiffstats
path: root/usr.sbin/rpc.yppasswdd/yppasswdd_server.c
Commit message (Collapse)AuthorAgeFilesLines
* Wrap EXPAND(..) macro with a do-while(0) loop and put a single statement on ↵ngie2016-05-221-1/+4
| | | | | | | | | | | | | each line As a positive side-effect, this eliminates the double semicolons reported by Coverity: the macro contained a trailing semicolon, in addition to the semicolon placed on each line where EXPAND(..) was called. MFC after: 1 week Reported by: Coverity CID: 1194269 Sponsored by: EMC / Isilon Storage Division
* The rpc.yppasswdd has an option to not allow shell changes (-s), but isaraujo2015-10-021-2/+2
| | | | | | | | | | | | | always passed a shell by the remote yppasswd. If an NIS client overrides the shell provided by the ypserv, then yppasswd (pam_unix, actually, afaict) will pass this new shell to the yppasswdd. If this shell has been set on the client to a shell which is invalid on the server, a user will never be able to change their password on the client. PR: 67142 Submitted by: russell@rucus.ru.ac.za Approved by: bapt (mentor) Sponsored by: EuroBSDCon Sweden.
* Handle NULL return from crypt(3). Mostly from DragonFlykevlo2012-02-221-2/+3
|
* yppasswdd assumed that a struct x_master_passwd is type punable to aimp2009-02-181-3/+21
| | | | | | | | | | | | | | | | struct passwd. This is not the case when sizeof(unsigned long) != sizeof(time_t). Write a dinky function to do the assignment instead of relying on the punning. This does slow things down a little (1 extra function call, 11 pointer or int assignments), but is much safer and machines have been fast enough since the mid 1990s that nobody will notice the difference. time_t is a 64-bits int on arm and mips. Before this change, arm was silently broken. I guess there aren't that many ARM machines running master YP domain servers. :) The client side doesn't assume this type punning, so it doesn't need to be fixed.
* Fix yppasswdproc_update_master_1_svc() too.mbr2003-06-151-0/+32
| | | | | | | | | | Only call pw_mkdb if passfile == _PATH_MASTERPASSWD. Otherwise, rename master.passwd to a temp filename, rename the new passwd to master.passwd, and let yppwupdate update passwd as it sees fit. Reviewed by: phk Tested by: genesys
* Only call pw_mkdb if passfile == _PATH_MASTERPASSWD.mbr2003-06-151-9/+47
| | | | | | | | | | Otherwise, rename master.passwd to a temp filename, rename the new passwd to master.passwd, and let yppwupdate update passwd as it sees fit. PR: 52601, 7968 Reviewed by: des Submitted by: Dan Nelson <dnelson@allantgroup.com>
* Use __FBSDID over rcsid[]. Protect copyright[] where needed.obrien2003-05-031-4/+2
|
* Unbreak Alpha build.des2002-05-151-1/+2
|
* unbreak build: ditch multi-line string literalsalfred2002-05-111-1/+1
|
* Use libutil instead of pw_{copy,util}.c. Clean up a little. Warnsify.des2002-05-081-135/+104
| | | | Sponsored by: DARPA, NAI Labs
* ANSIfy and remove some dead code.des2002-02-061-23/+21
| | | | Sponsored by: DARPA, NAI Labs
* Apply the following mechanical transformations in preparation fordes2002-02-061-6/+6
| | | | | | | | | | | | | | | | | ansification and constification: s{\s+__P\((\(.*?\))\)}{$1}g; s{\(\s+}{\(}g; s{\s+\)}{\)}g; s{\s+,}{,}g; s{(\s+)(for|if|switch|while)\(}{$1$2 \(}g; s{return ([^\(].*?);}{return ($1);}g; s{([\w\)])([!=+/\*-]?=)([\w\(+-])}{$1 $2 $3}g; s{\s+$}{\n};g Also add $FreeBSD$ where needed. MFC after: 1 week
* Fix the breakage in rpc.yppasswd. Readded the svc_create() andalfred2002-02-051-21/+12
| | | | | | | | | | | the registering of the "unix" transport, now it is fixed. Everywhere, rq_cred is taken to look what authentification we have. We can not be sure that transp>xp_verf.oa_flavor is also filled in. This seems to be the same for all sun source. they take the flavor of rq_cred, instead of transp. Submitted by: mbr
* Fix the type of the NULL arg to execl()brian2001-07-091-4/+4
| | | | Idea from: Theo de Raadt <deraadt@openbsd.org>
* Correct a typo in an error message.dd2001-06-161-1/+1
|
* Remove struct cmessage from sys/socket.h and reintroduce the privatealfred2001-03-221-0/+5
| | | | | | definitions. Requested by: wollman
* Unbreak world by removing struct cmessage already define in sys/socket.hache2001-03-221-5/+0
|
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Protect errno in signal handlers, like in portmap.wpaul1998-06-041-1/+6
|
* Remove multiply defined Id string. Hide sccsid string.charnier1997-10-131-8/+7
|
* Modify rpc.yppasswdd to use the new AF_LOCAL transport in the RPC librarywpaul1997-07-291-34/+57
| | | | | instead of its own kludged up version. This makes the special 'superuser-only' update procedure work just like a real RPC service.
* Revert $FreeBSD$ to $Id$peter1997-02-221-2/+2
|
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-2/+2
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Fix harmless bugs found while hunting for chpass nis failurepeter1996-11-151-3/+3
|
* Add extra sanity checking to the in-place update routine. Sometimes youwpaul1996-10-231-2/+33
| | | | | | | | | | | | | find two users with the same UID (i.e. root and toor), but yp_mkdb(8) forbits duplicate keys, so only one of them will end up in the *.byuid maps (probably toor, since it comes after root in the template file). If I asked rpc.yppasswdd(8) to change toor's password, it would update the *.byname maps correctly, but incorrectly modify root's entry in the *.byuid maps since the only matching record with UID=0 in those maps belongs to root. To fix this, we check that both the name and UID are correct before trying to write new entries to the maps.
* When updating a password via the standard RPC handler, reset the passwordwpaul1996-09-051-2/+3
| | | | change time (pw_change) to zero.
* Fix a couple of bogons. The first two were brought to my attentionwpaul1996-08-041-9/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | by Peter Wemm: - In yppasswdproc_update_1_svc(), I wasn't paying attention and put a couple of lines of code _after_ a return() instead of before. (*blush*) - The removal of certain temp files didn't always work (this showed up mostly if you were using /etc/master.passwd as your NIS passwd template instead of /var/yp/master.passwd). This is because the whole temp file creation mechanism I was using was tragically broken (you can't rename across filesystems). This problem I found myself: - If you have a very large password database (30,000 or more entries), there can be a delay of several seconds while pw_copy() copies the ASCII template file and subsitutes in the modified/new entry. During this time, the clnt_udp() code in the RPC library may get impatient and retry its request. This will get queued at the server and be treated as a second request. By then the password change will have been completed and the second request will fail (the old password is no longer valid). To attempt to fix this, we save the IP address and port of each request and ignore any subsequent requests from the same IP and same port that arrive within five minutes of each other.
* Implement incremental passwd database updates. This is done by ading a '-u'guido1996-07-011-4/+4
| | | | | | | | | | | | | | option to pwd_mkdb and adding this option to utilities invoking it. Further, the filling of both the secure and insecure databases has been merged into one loop giving also a performance improvemnet. Note that I did *not* change the adduser command. I don't read perl (it is a write only language anyway). The change will drastically improve performance for passwd and friends with large passwd files. Vipw's performance won't change. In order to do that some kind of diff should be made between the old and new master.passwd and depending the amount of changes, an incremental or complete update of the databases should be agreed upon.
* Whoops: had a couple of hardcoded instances of '/var/yp/' that shouldn'twpaul1996-06-231-4/+4
| | | | have been there. Fixed to use yp_dir, which can be set on the command line.
* Added support for in-place updates:wpaul1996-06-051-7/+141
| | | | | | | | | | | | | | | | | If rpc.yppasswdd is invoked with the -i flag, password changes will be made to the master.passwd template file and the hash map files in-place, which means it won't have to run a complete map update. Instead, it calls /var/yp/Makefile with the 'pushpw' target, which just pushes the maps to the slaves and runs yp_mkdb -c to tell the local ypserv to flush its database cache. The server will check the passwd.byname and passwd.byuid maps to see if they were built in 'insecure' or 'secure' mode (i.e. with real encrypted passwords in them or without) and update them accordingly. This combined with rpc.ypxfrd greatly reduces the amount of time it takes to complete an NIS password change, especially with very large passwd databases.
* Fix 'multidomain' code. It returns a pointer to memory that it doesn'twpaul1996-05-081-8/+6
| | | | | | | | | | | | | | | | | really own (and which can end up being mangled later). The manifestation of this bug is that the first attempt by a user to change their NIS password succeeds, but all subsequent attempts fail. rpc.yppasswdd also logs a message about not being able to find a file called '/var/yp/<some garbage string>/master.passwd.' (Note that for some bizarre reason, this doesn't happen with the malloc() from FreeBSD 2.1.0. I suppose this means we can chalk up another victory for phkmalloc. :) This bug only occurs if you use the -m flag with rpc.yppasswdd. Fix this by copying the domain name to a static buffer and returning a pointer to that instead. Reported by: Jian-Da Li (jdli@csie.nctu.edu.tw)
* Add securenets support (uses same access control mechanism as ypserv,wpaul1996-02-241-2/+8
| | | | | | | | | | | | | | | also controlled by /var/yp/securenets). Add -u flag to turn off the privileged port check done by yp_access(); some commercial systems (IRIX, Solaris 2.x, HP-UX, and probably others) don't use a reserved port for submitting yppasswd updates. If we always enforce the check, these client systems will be unable to submit updates to us. Document securenets support and -u flag in man page. Like ypserv, you can compile rpc.yppasswdd to use the tcpwrapper package instead of securenets if you want to.
* This commit was generated by cvs2svn to compensate for changes in r14062,wpaul1996-02-121-0/+649
which included commits to RCS files with non-trunk default branches.
OpenPOWER on IntegriCloud