shadow-utils/shadow-4.2.1-no-lock-dos.patch
Björn Esser 41955fa9ab
Add patch to include crypt.h, if present
Use %%make_{build,install} macros
Refresh other patches for proper alignment
2018-02-06 11:33:37 +01:00

17 lines
541 B
Diff

Index: shadow-4.5/lib/commonio.c
===================================================================
--- shadow-4.5.orig/lib/commonio.c
+++ shadow-4.5/lib/commonio.c
@@ -140,7 +140,10 @@ static int do_lock_file (const char *fil
int retval;
char buf[32];
- fd = open (file, O_CREAT | O_EXCL | O_WRONLY, 0600);
+ /* We depend here on the fact, that the file name is pid-specific.
+ * So no O_EXCL here and no DoS.
+ */
+ fd = open (file, O_CREAT | O_TRUNC | O_WRONLY, 0600);
if (-1 == fd) {
if (log) {
(void) fprintf (stderr,