MFP4: return the actual value of the requested variable (#24840)
This commit is contained in:
parent
60f020541d
commit
f3ea2ebc1b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/openpam/dist/; revision=110558
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user