summaryrefslogtreecommitdiffstats
path: root/login-utils/setpwnam.c
Commit message (Collapse)AuthorAgeFilesLines
* setpwnam: fix memory leakSami Kerola2016-04-191-0/+1
| | | | | | Found with scan-build. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* chsh, chfn, vipw: fix filenames collisionKarel Zak2015-08-241-3/+2Star
| | | | | | | | | | | | | | | | | | The utils when compiled WITHOUT libuser then mkostemp()ing "/etc/%s.XXXXXX" where the filename prefix is argv[0] basename. An attacker could repeatedly execute the util with modified argv[0] and after many many attempts mkostemp() may generate suffix which makes sense. The result maybe temporary file with name like rc.status ld.so.preload or krb5.keytab, etc. Note that distros usually use libuser based ch{sh,fn} or stuff from shadow-utils. It's probably very minor security bug. Addresses: CVE-2015-5224 Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: fix two misencodings in commentsBenno Schulenberg2013-02-061-2/+2
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* fileutils: xmkstemp() interface changeDave Reisner2012-06-021-1/+2
| | | | | | | | | | | We can not let the user control where TMPDIR is for this tempfile. This will be where we write the updated passwd file, and must be capable of being moved atomically with rename(2). Therefore, it cannot be on a different device, or setpwnam() and vipw/vigr programs will invariably fail with EXDEV. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* login-utils: add missing header, fix setpwnam.c fclose logicKarel Zak2012-04-111-1/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* login-utils: verify writing to streams was successfulSami Kerola2012-04-041-4/+2Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fileutils: differentiate xmkstemp and xfmkstempSami Kerola2012-03-181-2/+2
| | | | | | | | | | | | Let developer to choose, case by case, what sort of return value is best in her code. The xmkstemp() is for users who want file descriptor as return value of the function, xfmkstemp() will return FILE pointer. Proposed-By: Karel Zak <kzak@redhat.com> CC: Davidlohr Bueso <dave@gnu.org> Reference: http://marc.info/?l=util-linux-ng&m=133129570124003&w=2 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setpwnam: use xmkstemp() and lckpwdf()Sami Kerola2012-03-181-34/+18Star
| | | | | | Get rid private locking schema and use libc instead. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* chfn: fix use-after-free [coverity scan]Karel Zak2012-01-311-3/+5
| | | | | | access FILE pointer after failed fclose() results in undefined behavior Signed-off-by: Karel Zak <kzak@redhat.com>
* setpwnam: remove non-ANSI definitions [smatch scan]Sami Kerola2011-11-291-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* setpwnam: fix coding styleSami Kerola2011-11-291-164/+169
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* chfn, setpwnam: let config.h be in control of extensions in useSami Kerola2011-11-291-3/+0Star
| | | | | | | The autotools will set _GNU_SOURCE which removes necessity to have any _*_SOURCE definition in *.c files. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* chfn, chsh, setpwnam: get true/false from stdbool.hSami Kerola2011-11-231-6/+2Star
| | | | | | Requires C99, which should not be a problem. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* chsh: fix gcc link() warn_unused_result warningKarel Zak2011-02-171-1/+2
| | | | | | setpwnam.c:176:9: warning: ignoring return value of ‘link’, declared with attribute warn_unused_result Signed-off-by: Karel Zak <kzak@redhat.com>
* chsh: fix small memory leakKarel Zak2011-02-171-5/+9
| | | | | Reported-by: Steve Grubb <sgrubb@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* remove useless if-before-free tests.Jim Meyering2008-03-121-1/+1
| | | | | | | | | | | | | | | | E.g., in this example, the "if (p)" test is useless. if (p) free (p); I've been removing such tests systematically. Here's where I proposed it to the git folks, along with justification for why it's ok to perform this transformation, these days (no one uses SunOS4 anymore): http://thread.gmane.org/gmane.comp.version-control.git/74187 Signed-off-by: Jim Meyering <meyering@redhat.com>
* Imported from util-linux-2.11x tarball.Karel Zak2006-12-071-1/+1
|
* Imported from util-linux-2.10s tarball.Karel Zak2006-12-071-0/+5
|
* Imported from util-linux-2.9v tarball.Karel Zak2006-12-071-0/+1
|
* Imported from util-linux-2.7.1 tarball.Karel Zak2006-12-071-147/+119Star
|
* Imported from util-linux-2.5 tarball.Karel Zak2006-12-071-32/+72
|
* Imported from util-linux-2.2 tarball.Karel Zak2006-12-071-0/+209