mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 01:30:30 -04:00
MFP4: return the actual value of the requested variable (#24840)
This commit is contained in:
parent
60f020541d
commit
f3ea2ebc1b
1 changed files with 10 additions and 3 deletions
|
|
@ -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 a new issue