pam_getenv

Tomas Mraz tmraz at redhat.com
Fri Nov 28 10:00:33 UTC 2008


On Fri, 2008-11-28 at 15:17 +0530, Sudarshan Soma wrote:
> Thanks Tomas.
> I was refering to this document which refers ro SOLARIS APIs . Just
> wanted to clarify on linux. Thanks so much.
> 
> 
> http://cc.in2p3.fr/doc/phpman.php?parameter=pam_getenv&mode=man

Hmm, that's bad as it meens that's another thing we (Linux-PAM) differ
from Solaris. It also means for you if you want to support both
Linux-PAM and Solaris PAM you'll have to #ifdef the free() call
appropriately.


> On Fri, Nov 28, 2008 at 1:45 PM, Tomas Mraz <tmraz at redhat.com> wrote:
> > On Fri, 2008-11-28 at 11:55 +0530, Sudarshan Soma wrote:
> >> Hi All, Iam using pam_getenv in my PAM application. Can anyone please
> >> let me know should i free the memory pointed to const char in my
> >> application or its take care by libpam.
> >>
> >> I am bit confused. As per Documentation, it says the application
> >> should free it. Is that true. Please advice.
> >>
> >>  buf = pam_getenv(pamh,"PRIMARY");
> >>         if(buf != NULL && buf[0] != '\0' ) {
> >>             if (strcmp(buf, "TRUE") == 0) {
> >>                 printf("success\n ");
> >>             }
> >>         }
> >>
> >>         if (buf) {
> >>             //free(buf); // is this reqd???
> >>         }
> >
> > No, it must not be be freed, the pointer is pointing to memory managed
> > by the pam library itself and freed on pam_end() call.
> > --
> > Tomas Mraz
> > No matter how far down the wrong road you've gone, turn back.
> >                                              Turkish proverb
> >
> > _______________________________________________
> > Pam-list mailing list
> > Pam-list at redhat.com
> > https://www.redhat.com/mailman/listinfo/pam-list
> >
> 
> _______________________________________________
> Pam-list mailing list
> Pam-list at redhat.com
> https://www.redhat.com/mailman/listinfo/pam-list
-- 
Tomas Mraz
No matter how far down the wrong road you've gone, turn back.
                                              Turkish proverb




More information about the Pam-list mailing list