ReactOS 0.4.16-dev-197-g92996da
auth.h File Reference
#include <rpc/xdr.h>
#include <rpc/clnt_stat.h>
#include <sys/types.h>
Include dependency graph for auth.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  sec_data
 
struct  des_clnt_data
 
union  des_block
 
struct  opaque_auth
 
struct  __auth
 
struct  __auth::auth_ops
 

Macros

#define MAX_AUTH_BYTES   400
 
#define MAXNETNAMELEN   255 /* maximum length of network user's name */
 
#define AUTH_F_RPCTIMESYNC   0x001 /* use RPC to do time sync */
 
#define AUTH_F_TRYNONE   0x002 /* allow fall back to AUTH_NONE */
 
#define AUTH_NEXTVERF(auth)    ((*((auth)->ah_ops->ah_nextverf))(auth))
 
#define auth_nextverf(auth)    ((*((auth)->ah_ops->ah_nextverf))(auth))
 
#define AUTH_MARSHALL(auth, xdrs, seq)    ((*((auth)->ah_ops->ah_marshal))(auth, xdrs, seq))
 
#define auth_marshall(auth, xdrs, seq)    ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))
 
#define AUTH_VALIDATE(auth, verfp, seq)    ((*((auth)->ah_ops->ah_validate))((auth), verfp, seq))
 
#define auth_validate(auth, verfp, seq)    ((*((auth)->ah_ops->ah_validate))((auth), verfp, seq))
 
#define AUTH_REFRESH(auth, msg)    ((*((auth)->ah_ops->ah_refresh))(auth, msg))
 
#define auth_refresh(auth, msg)    ((*((auth)->ah_ops->ah_refresh))(auth, msg))
 
#define AUTH_DESTROY(auth)    ((*((auth)->ah_ops->ah_destroy))(auth))
 
#define auth_destroy(auth)    ((*((auth)->ah_ops->ah_destroy))(auth))
 
#define AUTH_WRAP(auth, xdrs, xfunc, xwhere)
 
#define auth_wrap(auth, xdrs, xfunc, xwhere)
 
#define AUTH_UNWRAP(auth, xdrs, xfunc, xwhere, seq)
 
#define auth_unwrap(auth, xdrs, xfunc, xwhere, seq)
 
#define authsys_create(c, i1, i2, i3, ip)   authunix_create((c),(i1),(i2),(i3),(ip))
 
#define authsys_create_default()   authunix_create_default()
 
#define AUTH_NONE   0 /* no authentication */
 
#define AUTH_NULL   0 /* backward compatibility */
 
#define AUTH_SYS   1 /* unix style (uid, gids) */
 
#define AUTH_UNIX   AUTH_SYS
 
#define AUTH_SHORT   2 /* short hand unix style */
 
#define AUTH_DH   3 /* for Diffie-Hellman mechanism */
 
#define AUTH_DES   AUTH_DH /* for backward compatibility */
 
#define AUTH_KERB   4 /* kerberos style */
 
#define RPCSEC_GSS   6 /* RPCSEC_GSS */
 

Typedefs

typedef struct sec_data sec_data_t
 
typedef struct des_clnt_data dh_k4_clntdata_t
 
typedef u_int32_t u_int32
 
typedef union des_block des_block
 
typedef struct __auth AUTH
 

Enumerations

enum  auth_stat {
  AUTH_OK =0 , AUTH_BADCRED =1 , AUTH_REJECTEDCRED =2 , AUTH_BADVERF =3 ,
  AUTH_REJECTEDVERF =4 , AUTH_TOOWEAK =5 , AUTH_INVALIDRESP =6 , AUTH_FAILED =7 ,
  RPCSEC_GSS_CREDPROBLEM = 13 , RPCSEC_GSS_CTXPROBLEM = 14
}
 

Functions

__BEGIN_DECLS bool_t xdr_des_block (XDR *, des_block *)
 
__END_DECLS int authany_wrap (void)
 
__END_DECLS int authany_unwrap (void)
 
__BEGIN_DECLS AUTHauthunix_create (char *, uid_t, uid_t, int, uid_t *)
 
AUTHauthunix_create_default (void)
 
AUTHauthnone_create (void)
 
__END_DECLS __BEGIN_DECLS AUTHauthdes_create (char *, u_int, struct sockaddr *, des_block *)
 
AUTHauthdes_seccreate (const char *, const u_int, const char *, const des_block *)
 
__END_DECLS __BEGIN_DECLS bool_t xdr_opaque_auth (XDR *, struct opaque_auth *)
 
__BEGIN_DECLS int getnetname (char *)
 
int host2netname (char *, const char *, const char *)
 
int user2netname (char *, const uid_t, const char *)
 
int netname2user (char *, uid_t *, gid_t *, int *, gid_t *)
 
int netname2host (char *, char *, const int)
 
void passwd2des (char *, char *)
 
__END_DECLS __BEGIN_DECLS int key_decryptsession (const char *, des_block *)
 
int key_encryptsession (const char *, des_block *)
 
int key_gendes (des_block *)
 
int key_setsecret (const char *)
 
int key_secretkey_is_set (void)
 
__END_DECLS __BEGIN_DECLS int getpublickey (const char *, char *)
 
int getpublicandprivatekey (char *, char *)
 
int getsecretkey (char *, char *, char *)
 
enum auth_stat _svcauth_null (struct svc_req *, struct rpc_msg *)
 
enum auth_stat _svcauth_short (struct svc_req *, struct rpc_msg *)
 
enum auth_stat _svcauth_unix (struct svc_req *, struct rpc_msg *)
 

Variables

__BEGIN_DECLS struct opaque_auth _null_auth
 

Macro Definition Documentation

◆ AUTH_DES

#define AUTH_DES   AUTH_DH /* for backward compatibility */

Definition at line 407 of file auth.h.

◆ AUTH_DESTROY

#define AUTH_DESTROY (   auth)     ((*((auth)->ah_ops->ah_destroy))(auth))

Definition at line 257 of file auth.h.

◆ auth_destroy

#define auth_destroy (   auth)     ((*((auth)->ah_ops->ah_destroy))(auth))

Definition at line 259 of file auth.h.

◆ AUTH_DH

#define AUTH_DH   3 /* for Diffie-Hellman mechanism */

Definition at line 406 of file auth.h.

◆ AUTH_F_RPCTIMESYNC

#define AUTH_F_RPCTIMESYNC   0x001 /* use RPC to do time sync */

Definition at line 137 of file auth.h.

◆ AUTH_F_TRYNONE

#define AUTH_F_TRYNONE   0x002 /* allow fall back to AUTH_NONE */

Definition at line 138 of file auth.h.

◆ AUTH_KERB

#define AUTH_KERB   4 /* kerberos style */

Definition at line 408 of file auth.h.

◆ AUTH_MARSHALL

#define AUTH_MARSHALL (   auth,
  xdrs,
  seq 
)     ((*((auth)->ah_ops->ah_marshal))(auth, xdrs, seq))

Definition at line 242 of file auth.h.

◆ auth_marshall

#define auth_marshall (   auth,
  xdrs,
  seq 
)     ((*((auth)->ah_ops->ah_marshal))(auth, xdrs))

Definition at line 244 of file auth.h.

◆ AUTH_NEXTVERF

#define AUTH_NEXTVERF (   auth)     ((*((auth)->ah_ops->ah_nextverf))(auth))

Definition at line 237 of file auth.h.

◆ auth_nextverf

#define auth_nextverf (   auth)     ((*((auth)->ah_ops->ah_nextverf))(auth))

Definition at line 239 of file auth.h.

◆ AUTH_NONE

#define AUTH_NONE   0 /* no authentication */

Definition at line 401 of file auth.h.

◆ AUTH_NULL

#define AUTH_NULL   0 /* backward compatibility */

Definition at line 402 of file auth.h.

◆ AUTH_REFRESH

#define AUTH_REFRESH (   auth,
  msg 
)     ((*((auth)->ah_ops->ah_refresh))(auth, msg))

Definition at line 252 of file auth.h.

◆ auth_refresh

#define auth_refresh (   auth,
  msg 
)     ((*((auth)->ah_ops->ah_refresh))(auth, msg))

Definition at line 254 of file auth.h.

◆ AUTH_SHORT

#define AUTH_SHORT   2 /* short hand unix style */

Definition at line 405 of file auth.h.

◆ AUTH_SYS

#define AUTH_SYS   1 /* unix style (uid, gids) */

Definition at line 403 of file auth.h.

◆ AUTH_UNIX

#define AUTH_UNIX   AUTH_SYS

Definition at line 404 of file auth.h.

◆ AUTH_UNWRAP

#define AUTH_UNWRAP (   auth,
  xdrs,
  xfunc,
  xwhere,
  seq 
)
Value:
((*((auth)->ah_ops->ah_unwrap))(auth, xdrs, \
xfunc, xwhere, seq))

Definition at line 269 of file auth.h.

◆ auth_unwrap

#define auth_unwrap (   auth,
  xdrs,
  xfunc,
  xwhere,
  seq 
)
Value:
((*((auth)->ah_ops->ah_unwrap))(auth, xdrs, \
xfunc, xwhere, seq))

Definition at line 272 of file auth.h.

◆ AUTH_VALIDATE

#define AUTH_VALIDATE (   auth,
  verfp,
  seq 
)     ((*((auth)->ah_ops->ah_validate))((auth), verfp, seq))

Definition at line 247 of file auth.h.

◆ auth_validate

#define auth_validate (   auth,
  verfp,
  seq 
)     ((*((auth)->ah_ops->ah_validate))((auth), verfp, seq))

Definition at line 249 of file auth.h.

◆ AUTH_WRAP

#define AUTH_WRAP (   auth,
  xdrs,
  xfunc,
  xwhere 
)
Value:
((*((auth)->ah_ops->ah_wrap))(auth, xdrs, \
xfunc, xwhere))

Definition at line 262 of file auth.h.

◆ auth_wrap

#define auth_wrap (   auth,
  xdrs,
  xfunc,
  xwhere 
)
Value:
((*((auth)->ah_ops->ah_wrap))(auth, xdrs, \
xfunc, xwhere))

Definition at line 265 of file auth.h.

◆ authsys_create

#define authsys_create (   c,
  i1,
  i2,
  i3,
  ip 
)    authunix_create((c),(i1),(i2),(i3),(ip))

Definition at line 323 of file auth.h.

◆ authsys_create_default

#define authsys_create_default ( )    authunix_create_default()

Definition at line 324 of file auth.h.

◆ MAX_AUTH_BYTES

#define MAX_AUTH_BYTES   400

Definition at line 77 of file auth.h.

◆ MAXNETNAMELEN

#define MAXNETNAMELEN   255 /* maximum length of network user's name */

Definition at line 78 of file auth.h.

◆ RPCSEC_GSS

#define RPCSEC_GSS   6 /* RPCSEC_GSS */

Definition at line 409 of file auth.h.

Typedef Documentation

◆ AUTH

typedef struct __auth AUTH

◆ des_block

typedef union des_block des_block

Definition at line 187 of file auth.h.

◆ dh_k4_clntdata_t

◆ sec_data_t

◆ u_int32

typedef u_int32_t u_int32

Definition at line 178 of file auth.h.

Enumeration Type Documentation

◆ auth_stat

Enumerator
AUTH_OK 
AUTH_BADCRED 
AUTH_REJECTEDCRED 
AUTH_BADVERF 
AUTH_REJECTEDVERF 
AUTH_TOOWEAK 
AUTH_INVALIDRESP 
AUTH_FAILED 
RPCSEC_GSS_CREDPROBLEM 
RPCSEC_GSS_CTXPROBLEM 

Definition at line 144 of file auth.h.

144 {
145 AUTH_OK=0,
146 /*
147 * failed at remote end
148 */
149 AUTH_BADCRED=1, /* bogus credentials (seal broken) */
150 AUTH_REJECTEDCRED=2, /* client should begin new session */
151 AUTH_BADVERF=3, /* bogus verifier (seal broken) */
152 AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */
153 AUTH_TOOWEAK=5, /* rejected due to security reasons */
154 /*
155 * failed locally
156 */
157 AUTH_INVALIDRESP=6, /* bogus response verifier */
158 AUTH_FAILED=7, /* some unknown reason */
159#ifdef KERBEROS
160 /*
161 * kerberos errors
162 */
163 AUTH_KERB_GENERIC = 8, /* kerberos generic error */
164 AUTH_TIMEEXPIRE = 9, /* time of credential expired */
165 AUTH_TKT_FILE = 10, /* something wrong with ticket file */
166 AUTH_DECODE = 11, /* can't decode authenticator */
167 AUTH_NET_ADDR = 12, /* wrong net address in ticket */
168#endif /* KERBEROS */
169
170 /*
171 * RPCSEC_GSS errors
172 */
175
176};
@ RPCSEC_GSS_CREDPROBLEM
Definition: auth.h:173
@ AUTH_REJECTEDVERF
Definition: auth.h:152
@ AUTH_FAILED
Definition: auth.h:158
@ AUTH_BADCRED
Definition: auth.h:149
@ AUTH_BADVERF
Definition: auth.h:151
@ AUTH_TOOWEAK
Definition: auth.h:153
@ AUTH_OK
Definition: auth.h:145
@ AUTH_INVALIDRESP
Definition: auth.h:157
@ RPCSEC_GSS_CTXPROBLEM
Definition: auth.h:174
@ AUTH_REJECTEDCRED
Definition: auth.h:150

Function Documentation

◆ _svcauth_null()

enum auth_stat _svcauth_null ( struct svc_req rqst,
struct rpc_msg msg 
)

Definition at line 138 of file svc_auth.c.

141{
142 return (AUTH_OK);
143}

Referenced by _authenticate().

◆ _svcauth_short()

enum auth_stat _svcauth_short ( struct svc_req rqst,
struct rpc_msg msg 
)

Definition at line 142 of file svc_auth_unix.c.

145{
146 return (AUTH_REJECTEDCRED);
147}

Referenced by _authenticate().

◆ _svcauth_unix()

enum auth_stat _svcauth_unix ( struct svc_req rqst,
struct rpc_msg msg 
)

Definition at line 51 of file svc_auth_unix.c.

54{
55 enum auth_stat stat;
56 XDR xdrs;
57 struct authunix_parms *aup;
58 int32_t *buf;
59 struct area {
60 struct authunix_parms area_aup;
61 char area_machname[MAX_MACHINE_NAME+1];
62 gid_t area_gids[NGRPS];
63 } *area;
64 u_int auth_len;
65 size_t str_len, gid_len;
66 u_int i;
67
68 assert(rqst != NULL);
69 assert(msg != NULL);
70
71 area = (struct area *) rqst->rq_clntcred;
72 aup = &area->area_aup;
73 aup->aup_machname = area->area_machname;
74 aup->aup_gids = area->area_gids;
75 auth_len = (u_int)msg->rm_call.cb_cred.oa_length;
76 xdrmem_create(&xdrs, msg->rm_call.cb_cred.oa_base, auth_len,XDR_DECODE);
77 buf = XDR_INLINE(&xdrs, auth_len);
78 if (buf != NULL) {
83 goto done;
84 }
86 aup->aup_machname[str_len] = 0;
88 buf += str_len / sizeof (int32_t);
91 gid_len = (size_t)IXDR_GET_U_INT32(buf);
92 if (gid_len > NGRPS) {
94 goto done;
95 }
96 aup->aup_len = gid_len;
97 for (i = 0; i < gid_len; i++) {
99 }
100 /*
101 * five is the smallest unix credentials structure -
102 * timestamp, hostname len (0), uid, gid, and gids len (0).
103 */
104 if ((5 + gid_len) * BYTES_PER_XDR_UNIT + str_len > auth_len) {
105 (void) printf("bad auth_len gid %ld str %ld auth %u\n",
106 (long)gid_len, (long)str_len, auth_len);
108 goto done;
109 }
110 } else if (! xdr_authunix_parms(&xdrs, aup)) {
111 xdrs.x_op = XDR_FREE;
112 (void)xdr_authunix_parms(&xdrs, aup);
114 goto done;
115 }
116
117 /* get the verifier */
118 if ((u_int)msg->rm_call.cb_verf.oa_length) {
119 rqst->rq_xprt->xp_verf.oa_flavor =
120 msg->rm_call.cb_verf.oa_flavor;
121 rqst->rq_xprt->xp_verf.oa_base =
122 msg->rm_call.cb_verf.oa_base;
123 rqst->rq_xprt->xp_verf.oa_length =
124 msg->rm_call.cb_verf.oa_length;
125 } else {
126 rqst->rq_xprt->xp_verf.oa_flavor = AUTH_NULL;
127 rqst->rq_xprt->xp_verf.oa_length = 0;
128 }
129 stat = AUTH_OK;
130done:
131 XDR_DESTROY(&xdrs);
132 return (stat);
133}
#define stat
Definition: acwin.h:99
#define msg(x)
Definition: auth_time.c:54
#define MAX_MACHINE_NAME
Definition: auth_unix.h:51
#define NGRPS
Definition: auth_unix.h:54
bool_t xdr_authunix_parms(XDR *xdrs, struct authunix_parms *p)
Definition: authunix_prot.c:50
auth_stat
Definition: auth.h:144
#define AUTH_NULL
Definition: auth.h:402
UINT32 u_int
Definition: types.h:82
#define NULL
Definition: types.h:112
INT32 int32_t
Definition: types.h:71
UINT gid_t
Definition: types.h:89
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define assert(x)
Definition: debug.h:53
__kernel_size_t size_t
Definition: linux.h:237
#define printf
Definition: freeldr.h:97
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define int32_t
Definition: nsiface.idl:56
static Real area(Real A[2], Real B[2], Real C[2])
Definition: polyDBG.cc:50
#define long
Definition: qsort.c:33
#define IXDR_GET_U_INT32(buf)
Definition: rpcb_prot.h:18
#define IXDR_GET_INT32(buf)
Definition: rpcb_prot.h:12
struct opaque_auth xp_verf
Definition: svc.h:121
Definition: xdr.h:103
enum xdr_op x_op
Definition: xdr.h:104
gid_t * aup_gids
Definition: auth_unix.h:65
uid_t aup_uid
Definition: auth_unix.h:62
char * aup_machname
Definition: auth_unix.h:61
u_long aup_time
Definition: auth_unix.h:60
gid_t aup_gid
Definition: auth_unix.h:63
u_int aup_len
Definition: auth_unix.h:64
Definition: stat.h:55
void * rq_clntcred
Definition: svc.h:138
SVCXPRT * rq_xprt
Definition: svc.h:139
#define str_len
Definition: treelist.c:89
#define XDR_INLINE(xdrs, len)
Definition: xdr.h:209
@ XDR_DECODE
Definition: xdr.h:86
@ XDR_FREE
Definition: xdr.h:87
#define XDR_DESTROY(xdrs)
Definition: xdr.h:214
#define BYTES_PER_XDR_UNIT
Definition: xdr.h:93
#define RNDUP(x)
Definition: xdr.h:94
void xdrmem_create(XDR *xdrs, char *addr, u_int size, enum xdr_op op)
Definition: xdr_mem.c:94

Referenced by _authenticate().

◆ authany_unwrap()

__END_DECLS int authany_unwrap ( void  )

◆ authany_wrap()

__END_DECLS int authany_wrap ( void  )

◆ authdes_create()

__END_DECLS __BEGIN_DECLS AUTH * authdes_create ( char ,
u_int  ,
struct sockaddr ,
des_block  
)

◆ authdes_seccreate()

AUTH * authdes_seccreate ( const char servername,
const  u_int,
const char timehost,
const des_block ckey 
)

Definition at line 123 of file auth_des.c.

125{
126 u_char pkey_data[1024];
127 netobj pkey;
128 AUTH *dummy;
129
130 if (! getpublickey(servername, (char *) pkey_data)) {
131 //syslog(LOG_ERR,
132 // "authdes_seccreate: no public key found for %s",
133 // servername);
134 return (NULL);
135 }
136
137 pkey.n_bytes = (char *) pkey_data;
138 pkey.n_len = (u_int)strlen((char *)pkey_data) + 1;
139 dummy = authdes_pk_seccreate(servername, &pkey, win, timehost,
140 ckey, NULL);
141 return (dummy);
142}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
AUTH * authdes_pk_seccreate(const char *, netobj *, u_int, const char *, const des_block *, nis_server *)
Definition: auth_des.c:150
UCHAR u_char
Definition: types.h:80
int getpublickey(char *netname, char *publickey) const
Definition: getpublickey.c:166
static real win[4][36]
Definition: auth.h:205
Definition: xdr.h:332
u_int n_len
Definition: xdr.h:333
char * n_bytes
Definition: xdr.h:334

◆ authnone_create()

AUTH * authnone_create ( void  )

Definition at line 100 of file auth_none.c.

101{
103 XDR xdr_stream;
104 XDR *xdrs;
105 extern mutex_t authnone_lock;
106
108 if (ap == 0) {
109 ap = (struct authnone_private *)calloc(1, sizeof (*ap));
110 if (ap == 0) {
112 return (0);
113 }
115 }
116 if (!ap->mcnt) {
117 ap->no_client.ah_cred = ap->no_client.ah_verf = _null_auth;
118 ap->no_client.ah_ops = authnone_ops();
119 xdrs = &xdr_stream;
120 xdrmem_create(xdrs, ap->marshalled_client,
122 (void)xdr_opaque_auth(xdrs, &ap->no_client.ah_cred);
123 (void)xdr_opaque_auth(xdrs, &ap->no_client.ah_verf);
124 ap->mcnt = XDR_GETPOS(xdrs);
125 XDR_DESTROY(xdrs);
126 }
128 return (&ap->no_client);
129}
bool_t xdr_opaque_auth()
static struct auth_ops * authnone_ops()
Definition: auth_none.c:194
#define MAX_MARSHAL_SIZE
Definition: auth_none.c:77
mutex_t authnone_lock
Definition: mt_misc.c:44
#define mutex_lock(m)
Definition: reentrant.h:128
#define mutex_unlock(m)
Definition: reentrant.h:129
#define calloc
Definition: rosglue.h:14
struct opaque_auth _null_auth
Definition: module.h:456
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36
@ XDR_ENCODE
Definition: xdr.h:85
#define XDR_GETPOS(xdrs)
Definition: xdr.h:199

Referenced by clnt_dg_create(), clnt_raw_create(), and clnt_vc_create().

◆ authunix_create()

__BEGIN_DECLS AUTH * authunix_create ( char ,
uid_t  ,
uid_t  ,
int  ,
uid_t  
)

◆ authunix_create_default()

AUTH * authunix_create_default ( void  )

Definition at line 198 of file auth_unix.c.

199{
200 int len;
201 char machname[MAXHOSTNAMELEN + 1];
202 uid_t uid;
203 gid_t gid;
204 gid_t gids[NGRPS];
205
206 if (gethostname(machname, sizeof machname) == -1)
207 abort();
208 machname[sizeof(machname) - 1] = 0;
209#if 0
210 uid = geteuid();
211 gid = getegid();
212 if ((len = getgroups(NGRPS, gids)) < 0)
213 abort();
214#else
215 // XXX Need to figure out what to do here!
216 uid = 666;
217 gid = 777;
218 gids[0] = 0;
219 len = 0;
220#endif
221 /* XXX: interface problem; those should all have been unsigned */
222 return (authunix_create(machname, uid, gid, len, gids));
223}
AUTH * authunix_create(char *machname, uid_t uid, gid_t gid, int len, gid_t *aup_gids)
Definition: auth_unix.c:107
long uid_t
Definition: various.h:8
#define MAXHOSTNAMELEN
Definition: ftp.c:31
INT WSAAPI gethostname(OUT char FAR *name, IN INT namelen)
Definition: getxbyxx.c:397
EXPORT gid_t getegid()
Definition: gid.c:37
GLenum GLsizei len
Definition: glext.h:6722
#define abort()
Definition: i386-dis.c:34
EXPORT uid_t geteuid()
Definition: uid.c:37

Referenced by rpc_broadcast_exp().

◆ getnetname()

__BEGIN_DECLS int getnetname ( char )

◆ getpublicandprivatekey()

int getpublicandprivatekey ( char key,
char ret 
)

Definition at line 89 of file getpublickey.c.

92{
93 char buf[1024]; /* big enough */
94 char *res;
95 FILE *fd;
96 char *mkey;
97 char *mval;
98
99 fd = fopen(PKFILE, "r");
100 if (fd == NULL)
101 return (0);
102 for (;;) {
103 res = fgets(buf, sizeof(buf), fd);
104 if (res == NULL) {
105 fclose(fd);
106 return (0);
107 }
108 if (res[0] == '#')
109 continue;
110 else if (res[0] == '+') {
111#ifdef YP
112 char *PKMAP = "publickey.byname";
113 char *lookup;
114 char *domain;
115 int err;
116 int len;
117
118 err = yp_get_default_domain(&domain);
119 if (err) {
120 continue;
121 }
122 lookup = NULL;
123 err = yp_match(domain, PKMAP, key, strlen(key), &lookup, &len);
124 if (err) {
125#ifdef DEBUG
126 fprintf(stderr, "match failed error %d\n", err);
127#endif
128 continue;
129 }
130 lookup[len] = 0;
131 strcpy(ret, lookup);
132 fclose(fd);
133 free(lookup);
134 return (2);
135#else /* YP */
136#ifdef DEBUG
138"Bad record in %s '+' -- NIS not supported in this library copy\n", PKFILE);
139#endif /* DEBUG */
140 continue;
141#endif /* YP */
142 } else {
143 mkey = strsep(&res, "\t ");
144 if (mkey == NULL) {
146 "Bad record in %s -- %s", PKFILE, buf);
147 continue;
148 }
149 do {
150 mval = strsep(&res, " \t#\n");
151 } while (mval != NULL && !*mval);
152 if (mval == NULL) {
154 "Bad record in %s val problem - %s", PKFILE, buf);
155 continue;
156 }
157 if (strcmp(mkey, key) == 0) {
158 strcpy(ret, mval);
159 fclose(fd);
160 return (1);
161 }
162 }
163 }
164}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define free
Definition: debug_ros.c:5
static ULONG lookup[16]
Definition: vga.c:48
#define PKFILE
Definition: getpublickey.c:51
GLuint res
Definition: glext.h:9613
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
_Check_return_opt_ _CRTIMP char *__cdecl fgets(_Out_writes_z_(_MaxCount) char *_Buf, _In_ int _MaxCount, _Inout_ FILE *_File)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
#define err(...)
static int fd
Definition: io.c:51
Definition: cookie.c:42
Definition: copy.c:22
int ret

Referenced by __getpublickey_real().

◆ getpublickey()

__END_DECLS __BEGIN_DECLS int getpublickey ( const char ,
char  
)

◆ getsecretkey()

int getsecretkey ( char ,
char ,
char  
)

◆ host2netname()

int host2netname ( char ,
const char ,
const char  
)

◆ key_decryptsession()

__END_DECLS __BEGIN_DECLS int key_decryptsession ( const char ,
des_block  
)

◆ key_encryptsession()

int key_encryptsession ( const char ,
des_block  
)

◆ key_gendes()

int key_gendes ( des_block key)

Definition at line 225 of file key_call.c.

227{
228 if (!key_call((u_long)KEY_GEN, (xdrproc_t)xdr_void, NULL,
230 return (-1);
231 }
232 return (0);
233}
bool_t xdr_void(void)
Definition: xdr.c:92
unsigned long u_long
Definition: linux.h:269
static int key_call(u_long, xdrproc_t, void *, xdrproc_t, void *)
Definition: key_call.c:418
bool_t xdr_des_block(XDR *xdrs, des_block *blkp)
Definition: rpc_prot.c:100
bool_t(* xdrproc_t)(XDR *,...)
Definition: xdr.h:144

Referenced by authdes_pk_seccreate().

◆ key_secretkey_is_set()

int key_secretkey_is_set ( void  )

Definition at line 116 of file key_call.c.

117{
118 struct key_netstres kres;
119
120 memset((void*)&kres, 0, sizeof (kres));
121 if (key_call((u_long) KEY_NET_GET, (xdrproc_t)xdr_void, NULL,
122 (xdrproc_t)xdr_key_netstres, &kres) &&
123 (kres.status == KEY_SUCCESS) &&
124 (kres.key_netstres_u.knet.st_priv_key[0] != 0)) {
125 /* avoid leaving secret key in memory */
126 memset(kres.key_netstres_u.knet.st_priv_key, 0, HEXKEYBYTES);
127 return (1);
128 }
129 return (0);
130}
bool_t xdr_key_netstres(register XDR *xdrs, key_netstres *objp)
Definition: key_prot_xdr.c:158
#define memset(x, y, z)
Definition: compat.h:39

◆ key_setsecret()

int key_setsecret ( const char )

◆ netname2host()

int netname2host ( char ,
char ,
const int   
)

◆ netname2user()

int netname2user ( char ,
uid_t ,
gid_t ,
int ,
gid_t  
)

◆ passwd2des()

void passwd2des ( char ,
char  
)

◆ user2netname()

int user2netname ( char ,
const  uid_t,
const char  
)

◆ xdr_des_block()

__BEGIN_DECLS bool_t xdr_des_block ( XDR xdrs,
des_block blkp 
)

Definition at line 100 of file rpc_prot.c.

103{
104
105 assert(xdrs != NULL);
106 assert(blkp != NULL);
107
108 return (xdr_opaque(xdrs, (caddr_t)(void *)blkp, sizeof(des_block)));
109}
bool_t xdr_opaque(XDR *xdrs, caddr_t cp, u_int cnt)
Definition: xdr.c:484
char * caddr_t
Definition: rosdhcp.h:36

Referenced by key_gendes(), xdr_cryptkeyarg(), xdr_cryptkeyarg2(), and xdr_cryptkeyres().

◆ xdr_opaque_auth()

__END_DECLS __BEGIN_DECLS bool_t xdr_opaque_auth ( XDR xdrs,
struct opaque_auth ap 
)

Definition at line 82 of file rpc_prot.c.

85{
86
87 assert(xdrs != NULL);
88 assert(ap != NULL);
89
90 if (xdr_enum(xdrs, &(ap->oa_flavor)))
91 return (xdr_bytes(xdrs, &ap->oa_base,
92 &ap->oa_length, MAX_AUTH_BYTES));
93 return (FALSE);
94}
bool_t xdr_bytes(XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize)
Definition: xdr.c:536
bool_t xdr_enum(XDR *xdrs, enum_t *ep)
Definition: xdr.c:458
#define MAX_AUTH_BYTES
Definition: auth.h:77
#define FALSE
Definition: types.h:117

Variable Documentation

◆ _null_auth