[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: How to get ipaddress



On Fri, 2002-05-24 at 19:30, Yokota Sakuko wrote:

> > From the rhost or the tty, you can use whatever tools are available in
> > your language to get the IP address.
> 
> Does pam-get-item with PAM-RHOST give me a hostname of a user?
> If so,  I can call gethostbyname with the hostname.
> 
> Whenever I tried pam-get-item(pamh, PAM-RHOST, (void *)&buffer) ,
> buffer was unreadable.

I believe that either the application or a previous module has to set a
pam_item before it can be usefully used.

You can check whether there was an rhost set by checking the return
value of the function - if it's PAM_BAD_ITEM, the rhost is not set.
In fact, any return value other than PAM_SUCCESS means the buffer may
not be loaded.


  return_value = pam_get_item(handle, RAM_RHOST, buffer);
  if (return_value == PAM_SUCCESS) 
      strcpy(rhost, buffer);
  else {
      // put in error handling
  }



Jenn V.
-- 
    "Do you ever wonder if there's a whole section of geek culture 
        	you miss out on by being a geek?" - Dancer.

jenn@anthill.echidna.id.au     http://anthill.echidna.id.au/~jenn/






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []