diff options
author | Andreas Schneider <asn@samba.org> | 2019-11-15 09:45:22 +0100 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2019-11-15 11:35:40 +0100 |
commit | 50036d052a5746c91d94ceb7eb68a1aa9d8554fb (patch) | |
tree | 1f33d62a11800edd58abbacc53a4ca3c87e99656 | |
parent | 17ca36ee3899d0ee4936c1be235de06cab148ae5 (diff) | |
download | pam_wrapper-50036d052a5746c91d94ceb7eb68a1aa9d8554fb.tar.gz pam_wrapper-50036d052a5746c91d94ceb7eb68a1aa9d8554fb.tar.xz pam_wrapper-50036d052a5746c91d94ceb7eb68a1aa9d8554fb.zip |
pwrap: Use a define in pso_copy()
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
-rw-r--r-- | src/pam_wrapper.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/pam_wrapper.c b/src/pam_wrapper.c index d7802fb..8997e36 100644 --- a/src/pam_wrapper.c +++ b/src/pam_wrapper.c @@ -779,12 +779,13 @@ static void pwrap_clean_stale_dirs(const char *dir) static int pso_copy(const char *src, const char *dst, const char *pdir, mode_t mode) { +#define PSO_COPY_READ_SIZE 9 int srcfd = -1; int dstfd = -1; int rc = -1; ssize_t bread, bwritten; struct stat sb; - char buf[10]; + char buf[PSO_COPY_READ_SIZE + 1]; int cmp; size_t to_read; bool found_slash; @@ -831,10 +832,10 @@ static int pso_copy(const char *src, const char *dst, const char *pdir, mode_t m to_read = 1; if (!found_slash && buf[0] == '/') { found_slash = true; - to_read = 9; + to_read = PSO_COPY_READ_SIZE; } - if (found_slash && bread == 9) { + if (found_slash && bread == PSO_COPY_READ_SIZE) { cmp = memcmp(buf, "etc/pam.d", 9); if (cmp == 0) { memcpy(buf, pdir + 1, 9); @@ -869,6 +870,7 @@ out: } return rc; +#undef PSO_COPY_READ_SIZE } static void pwrap_init(void) |