aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2003-02-08 20:19:10 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2003-02-08 20:19:10 +0000
commitf3ea2ebc1b39b7bcdd7fef801d7a1d17fa8f46ba (patch)
treefed8b5a364d4c157738c801d03ae5340db91afee
parent60f020541d35b0e5082dcacb7a9e423085e667c3 (diff)
downloadsrc-f3ea2ebc1b39b7bcdd7fef801d7a1d17fa8f46ba.tar.gz
src-f3ea2ebc1b39b7bcdd7fef801d7a1d17fa8f46ba.zip
MFP4: return the actual value of the requested variable (#24840)
Notes
Notes: svn path=/vendor/openpam/dist/; revision=110558
-rw-r--r--contrib/openpam/lib/pam_getenv.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/contrib/openpam/lib/pam_getenv.c b/contrib/openpam/lib/pam_getenv.c
index a00c7cf4e404..58ad28369878 100644
--- a/contrib/openpam/lib/pam_getenv.c
+++ b/contrib/openpam/lib/pam_getenv.c
@@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $P4: //depot/projects/openpam/lib/pam_getenv.c#10 $
+ * $P4: //depot/projects/openpam/lib/pam_getenv.c#12 $
*/
#include <stdlib.h>
@@ -52,16 +52,23 @@ char *
pam_getenv(pam_handle_t *pamh,
const char *name)
{
+ char *str;
int i;
- ENTER();
+ ENTERS(name);
if (pamh == NULL)
RETURNS(NULL);
if (name == NULL || strchr(name, '=') != NULL)
RETURNS(NULL);
if ((i = openpam_findenv(pamh, name, strlen(name))) == -1)
RETURNS(NULL);
- RETURNS(strdup(pamh->env[i]));
+ for (str = pamh->env[i]; *str != '\0'; ++str) {
+ if (*str == '=') {
+ ++str;
+ break;
+ }
+ }
+ RETURNS(str);
}
/**