ReactOS 0.4.16-dev-336-gb667d82
svc_auth_unix.c File Reference
#include <wintirpc.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <rpc/rpc.h>
Include dependency graph for svc_auth_unix.c:

Go to the source code of this file.

Functions

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

Function Documentation

◆ _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}
@ AUTH_REJECTEDCRED
Definition: auth.h:150

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
auth_stat
Definition: auth.h:144
@ AUTH_BADCRED
Definition: auth.h:149
@ AUTH_OK
Definition: auth.h:145
#define AUTH_NULL
Definition: auth.h:402
#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
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().