MFP4: return the actual value of the requested variable (#24840)

This commit is contained in:
des 2003-02-08 20:19:10 +00:00
parent 08e4475303
commit 5945314a7a

View File

@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $P4: //depot/projects/openpam/lib/pam_getenv.c#10 $ * $P4: //depot/projects/openpam/lib/pam_getenv.c#12 $
*/ */
#include <stdlib.h> #include <stdlib.h>
@ -52,16 +52,23 @@ char *
pam_getenv(pam_handle_t *pamh, pam_getenv(pam_handle_t *pamh,
const char *name) const char *name)
{ {
char *str;
int i; int i;
ENTER(); ENTERS(name);
if (pamh == NULL) if (pamh == NULL)
RETURNS(NULL); RETURNS(NULL);
if (name == NULL || strchr(name, '=') != NULL) if (name == NULL || strchr(name, '=') != NULL)
RETURNS(NULL); RETURNS(NULL);
if ((i = openpam_findenv(pamh, name, strlen(name))) == -1) if ((i = openpam_findenv(pamh, name, strlen(name))) == -1)
RETURNS(NULL); RETURNS(NULL);
RETURNS(strdup(pamh->env[i])); for (str = pamh->env[i]; *str != '\0'; ++str) {
if (*str == '=') {
++str;
break;
}
}
RETURNS(str);
} }
/** /**