[SSSD] [PATCH] CRYPTO: Use unprefixed version of function stpncpy

Lukas Slebodnik lslebodn at redhat.com
Sat May 17 17:35:57 UTC 2014


ehlo,

glibc contains two versions of finction stpncpy
sh-4.2$ nm --dynamic --defined-only /lib64/libc.so.6 | grep stpncpy
0000003ce1c89b00 i stpncpy
0000003ce1c89b00 i __stpncpy
0000003ce1d040a0 T __stpncpy_chk

We should use more portable version of stpncpy without prefix with underscores.

The function __stpncpy was used in initial veersion
e65c65fc710fa030bfb8319efc43fcdc9ce5a26f, which was based on
http://people.redhat.com/drepper/SHA-crypt.txt

patch is simple replacement "s/__stpncpy/stpncpy/"

LS
-------------- next part --------------
>From 3b204bf80756215ce3be33222ffc006eae11c462 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Sat, 17 May 2014 18:34:23 +0200
Subject: [PATCH 3/5] CRYPTO: Use unprefixed version of function stpncpy

glibc contains two versions of finction stpncpy
sh-4.2$ nm --dynamic --defined-only /lib64/libc.so.6 | grep stpncpy
0000003ce1c89b00 i stpncpy
0000003ce1c89b00 i __stpncpy
0000003ce1d040a0 T __stpncpy_chk

We should use more portable version of stpncpy without prefix with underscores.

The function __stpncpy was used in initial veersion
e65c65fc710fa030bfb8319efc43fcdc9ce5a26f, which was based on
http://people.redhat.com/drepper/SHA-crypt.txt
---
 src/util/crypto/libcrypto/crypto_sha512crypt.c | 4 ++--
 src/util/crypto/nss/nss_sha512crypt.c          | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/util/crypto/libcrypto/crypto_sha512crypt.c b/src/util/crypto/libcrypto/crypto_sha512crypt.c
index 88628b686d8ced78e0c21a6b641086b673ca7fc4..34547d08abdc3cb3ea946291bc82120c2565fd49 100644
--- a/src/util/crypto/libcrypto/crypto_sha512crypt.c
+++ b/src/util/crypto/libcrypto/crypto_sha512crypt.c
@@ -266,7 +266,7 @@ static int sha512_crypt_r(const char *key,
         goto done;
     }
 
-    cp = __stpncpy(buffer, sha512_salt_prefix, SALT_PREF_SIZE);
+    cp = stpncpy(buffer, sha512_salt_prefix, SALT_PREF_SIZE);
     buflen -= SALT_PREF_SIZE;
 
     if (rounds_custom) {
@@ -284,7 +284,7 @@ static int sha512_crypt_r(const char *key,
         ret = ERANGE;
         goto done;
     }
-    cp = __stpncpy(cp, salt, salt_len);
+    cp = stpncpy(cp, salt, salt_len);
     *cp++ = '$';
     buflen -= salt_len + 1;
 
diff --git a/src/util/crypto/nss/nss_sha512crypt.c b/src/util/crypto/nss/nss_sha512crypt.c
index 2838c4716b2c8d94cacb35737725f4f63552c4aa..9fedd5ec6c62855d9cc0c9c2869d8c9be7fb5ade 100644
--- a/src/util/crypto/nss/nss_sha512crypt.c
+++ b/src/util/crypto/nss/nss_sha512crypt.c
@@ -267,7 +267,7 @@ static int sha512_crypt_r(const char *key,
         goto done;
     }
 
-    cp = __stpncpy(buffer, sha512_salt_prefix, SALT_PREF_SIZE);
+    cp = stpncpy(buffer, sha512_salt_prefix, SALT_PREF_SIZE);
     buflen -= SALT_PREF_SIZE;
 
     if (rounds_custom) {
@@ -285,7 +285,7 @@ static int sha512_crypt_r(const char *key,
         ret = ERANGE;
         goto done;
     }
-    cp = __stpncpy(cp, salt, salt_len);
+    cp = stpncpy(cp, salt, salt_len);
     *cp++ = '$';
     buflen -= salt_len + 1;
 
-- 
1.9.0



More information about the sssd-devel mailing list