Back to index

glibc  2.9
Classes | Defines | Enumerations | Functions
auth_des.h File Reference
#include <sys/cdefs.h>
#include <rpc/auth.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  authdes_fullname
struct  authdes_cred
struct  rpc_timeval
struct  authdes_verf
union  authdes_verf.adv_time_u

Defines

#define adv_timestamp   adv_time_u.adv_ctime
#define adv_xtimestamp   adv_time_u.adv_xtime
#define adv_winverf   adv_int_u
#define adv_timeverf   adv_time_u.adv_ctime
#define adv_xtimeverf   adv_time_u.adv_xtime
#define adv_nickname   adv_int_u

Enumerations

enum  authdes_namekind { ADN_FULLNAME, ADN_NICKNAME }

Functions

int authdes_getucred (__const struct authdes_cred *__adc, uid_t *__uid, gid_t *__gid, short *__grouplen, gid_t *__groups) __THROW
int getpublickey (__const char *__name, char *__key) __THROW
int getsecretkey (__const char *__name, char *__key, __const char *__passwd) __THROW
int rtime (struct sockaddr_in *__addrp, struct rpc_timeval *__timep, struct rpc_timeval *__timeout) __THROW

Class Documentation

struct authdes_fullname

Definition at line 36 of file auth_des.h.

Class Members
des_block key
char * name
uint32_t window
struct authdes_cred

Definition at line 44 of file auth_des.h.

Class Members
uint32_t adc_nickname
enum authdes_namekind struct authdes_fullname
struct rpc_timeval

Definition at line 52 of file auth_des.h.

Class Members
uint32_t tv_sec
uint32_t tv_usec
struct authdes_verf

Definition at line 59 of file auth_des.h.

Class Members
uint32_t adv_int_u
union authdes_verf adv_time_u
union authdes_verf.adv_time_u

Definition at line 61 of file auth_des.h.

Class Members
des_block adv_xtime

Define Documentation

#define adv_nickname   adv_int_u

Definition at line 86 of file auth_des.h.

#define adv_timestamp   adv_time_u.adv_ctime

Definition at line 75 of file auth_des.h.

#define adv_timeverf   adv_time_u.adv_ctime

Definition at line 84 of file auth_des.h.

#define adv_winverf   adv_int_u

Definition at line 77 of file auth_des.h.

#define adv_xtimestamp   adv_time_u.adv_xtime

Definition at line 76 of file auth_des.h.

#define adv_xtimeverf   adv_time_u.adv_xtime

Definition at line 85 of file auth_des.h.


Enumeration Type Documentation

Enumerator:
ADN_FULLNAME 
ADN_NICKNAME 

Definition at line 28 of file auth_des.h.


Function Documentation

int authdes_getucred ( __const struct authdes_cred __adc,
uid_t __uid,
gid_t __gid,
short *  __grouplen,
gid_t __groups 
)
int getpublickey ( __const char *  __name,
char *  __key 
)
int getsecretkey ( __const char *  __name,
char *  __key,
__const char *  __passwd 
)
int rtime ( struct sockaddr_in __addrp,
struct rpc_timeval __timep,
struct rpc_timeval __timeout 
)

Definition at line 73 of file rtime.c.

{
  int s;
  struct pollfd fd;
  int milliseconds;
  int res;
  /* RFC 868 says the time is transmitted as a 32-bit value.  */
  uint32_t thetime;
  struct sockaddr_in from;
  socklen_t fromlen;
  int type;

  if (timeout == NULL)
    type = SOCK_STREAM;
  else
    type = SOCK_DGRAM;

  s = __socket (AF_INET, type, 0);
  if (s < 0)
    return (-1);

  addrp->sin_family = AF_INET;
  addrp->sin_port = htons (IPPORT_TIMESERVER);
  if (type == SOCK_DGRAM)
    {
      res = __sendto (s, (char *) &thetime, sizeof (thetime), 0,
                    (struct sockaddr *) addrp, sizeof (*addrp));
      if (res < 0)
       {
         do_close (s);
         return -1;
       }
      milliseconds = (timeout->tv_sec * 1000) + (timeout->tv_usec / 1000);
      fd.fd = s;
      fd.events = POLLIN;
      do
       res = __poll (&fd, 1, milliseconds);
      while (res < 0 && errno == EINTR);
      if (res <= 0)
       {
         if (res == 0)
           __set_errno (ETIMEDOUT);
         do_close (s);
         return (-1);
       }
      fromlen = sizeof (from);
      res = __recvfrom (s, (char *) &thetime, sizeof (thetime), 0,
                     (struct sockaddr *) &from, &fromlen);
      do_close (s);
      if (res < 0)
       return -1;
    }
  else
    {
      if (__connect (s, (struct sockaddr *) addrp, sizeof (*addrp)) < 0)
       {
         do_close (s);
         return -1;
       }
      res = __read (s, (char *) &thetime, sizeof (thetime));
      do_close (s);
      if (res < 0)
       return (-1);
    }
  if (res != sizeof (thetime))
    {
      __set_errno (EIO);
      return -1;
    }
  thetime = ntohl (thetime);
  timep->tv_sec = thetime - TOFFSET;
  timep->tv_usec = 0;
  return 0;
}

Here is the call graph for this function: