Lines Matching refs:ad
155 struct ad_private *ad; in authdes_pk_seccreate() local
166 ad = ALLOC(struct ad_private); in authdes_pk_seccreate()
167 if (ad == NULL) { in authdes_pk_seccreate()
171 ad->ad_fullname = ad->ad_servername = NULL; /* Sanity reasons */ in authdes_pk_seccreate()
172 ad->ad_timehost = NULL; in authdes_pk_seccreate()
173 ad->ad_netid = NULL; in authdes_pk_seccreate()
174 ad->ad_uaddr = NULL; in authdes_pk_seccreate()
175 ad->ad_nis_srvr = NULL; in authdes_pk_seccreate()
176 ad->ad_timediff.tv_sec = 0; in authdes_pk_seccreate()
177 ad->ad_timediff.tv_usec = 0; in authdes_pk_seccreate()
178 memcpy(ad->ad_pkey, pkey->n_bytes, pkey->n_len); in authdes_pk_seccreate()
181 ad->ad_fullnamelen = RNDUP((u_int) strlen(namebuf)); in authdes_pk_seccreate()
182 ad->ad_fullname = (char *)mem_alloc(ad->ad_fullnamelen + 1); in authdes_pk_seccreate()
183 ad->ad_servernamelen = strlen(servername); in authdes_pk_seccreate()
184 ad->ad_servername = (char *)mem_alloc(ad->ad_servernamelen + 1); in authdes_pk_seccreate()
186 if (ad->ad_fullname == NULL || ad->ad_servername == NULL) { in authdes_pk_seccreate()
191 ad->ad_timehost = (char *)mem_alloc(strlen(timehost) + 1); in authdes_pk_seccreate()
192 if (ad->ad_timehost == NULL) { in authdes_pk_seccreate()
196 memcpy(ad->ad_timehost, timehost, strlen(timehost) + 1); in authdes_pk_seccreate()
197 ad->ad_dosync = TRUE; in authdes_pk_seccreate()
199 ad->ad_nis_srvr = srvr; /* transient */ in authdes_pk_seccreate()
200 ad->ad_dosync = TRUE; in authdes_pk_seccreate()
202 ad->ad_dosync = FALSE; in authdes_pk_seccreate()
204 memcpy(ad->ad_fullname, namebuf, ad->ad_fullnamelen + 1); in authdes_pk_seccreate()
205 memcpy(ad->ad_servername, servername, ad->ad_servernamelen + 1); in authdes_pk_seccreate()
206 ad->ad_window = window; in authdes_pk_seccreate()
223 auth->ah_private = (caddr_t)ad; in authdes_pk_seccreate()
228 ad->ad_nis_srvr = NULL; /* not needed any longer */ in authdes_pk_seccreate()
234 if (ad) { in authdes_pk_seccreate()
235 if (ad->ad_fullname) in authdes_pk_seccreate()
236 FREE(ad->ad_fullname, ad->ad_fullnamelen + 1); in authdes_pk_seccreate()
237 if (ad->ad_servername) in authdes_pk_seccreate()
238 FREE(ad->ad_servername, ad->ad_servernamelen + 1); in authdes_pk_seccreate()
239 if (ad->ad_timehost) in authdes_pk_seccreate()
240 FREE(ad->ad_timehost, strlen(ad->ad_timehost) + 1); in authdes_pk_seccreate()
241 if (ad->ad_netid) in authdes_pk_seccreate()
242 FREE(ad->ad_netid, strlen(ad->ad_netid) + 1); in authdes_pk_seccreate()
243 if (ad->ad_uaddr) in authdes_pk_seccreate()
244 FREE(ad->ad_uaddr, strlen(ad->ad_uaddr) + 1); in authdes_pk_seccreate()
245 FREE(ad, sizeof (struct ad_private)); in authdes_pk_seccreate()
273 struct ad_private *ad = AUTH_PRIVATE(auth); in authdes_marshal() local
274 struct authdes_cred *cred = &ad->ad_cred; in authdes_marshal()
275 struct authdes_verf *verf = &ad->ad_verf; in authdes_marshal()
286 (void)gettimeofday(&ad->ad_timestamp, NULL); in authdes_marshal()
287 ad->ad_timestamp.tv_sec += ad->ad_timediff.tv_sec; in authdes_marshal()
288 ad->ad_timestamp.tv_usec += ad->ad_timediff.tv_usec; in authdes_marshal()
289 while (ad->ad_timestamp.tv_usec >= USEC_PER_SEC) { in authdes_marshal()
290 ad->ad_timestamp.tv_usec -= USEC_PER_SEC; in authdes_marshal()
291 ad->ad_timestamp.tv_sec++; in authdes_marshal()
299 IXDR_PUT_INT32(ixdr, ad->ad_timestamp.tv_sec); in authdes_marshal()
300 IXDR_PUT_INT32(ixdr, ad->ad_timestamp.tv_usec); in authdes_marshal()
301 if (ad->ad_cred.adc_namekind == ADN_FULLNAME) { in authdes_marshal()
302 IXDR_PUT_U_INT32(ixdr, ad->ad_window); in authdes_marshal()
303 IXDR_PUT_U_INT32(ixdr, ad->ad_window - 1); in authdes_marshal()
317 ad->ad_verf.adv_xtimestamp = cryptbuf[0]; in authdes_marshal()
318 if (ad->ad_cred.adc_namekind == ADN_FULLNAME) { in authdes_marshal()
319 ad->ad_cred.adc_fullname.window = cryptbuf[1].key.high; in authdes_marshal()
320 ad->ad_verf.adv_winverf = cryptbuf[1].key.low; in authdes_marshal()
322 ad->ad_cred.adc_nickname = ad->ad_nickname; in authdes_marshal()
323 ad->ad_verf.adv_winverf = 0; in authdes_marshal()
330 if (ad->ad_cred.adc_namekind == ADN_FULLNAME) { in authdes_marshal()
331 len = ((1 + 1 + 2 + 1)*BYTES_PER_XDR_UNIT + ad->ad_fullnamelen); in authdes_marshal()
365 struct ad_private *ad = AUTH_PRIVATE(auth); in authdes_validate() local
402 if (bcmp((char *)&ad->ad_timestamp, (char *)&verf.adv_timestamp, in authdes_validate()
411 ad->ad_nickname = verf.adv_nickname; in authdes_validate()
412 ad->ad_cred.adc_namekind = ADN_NICKNAME; in authdes_validate()
424 struct ad_private *ad = AUTH_PRIVATE(auth); in authdes_refresh() local
425 struct authdes_cred *cred = &ad->ad_cred; in authdes_refresh()
429 if (ad->ad_dosync) { in authdes_refresh()
430 ok = __rpc_get_time_offset(&ad->ad_timediff, ad->ad_nis_srvr, in authdes_refresh()
431 ad->ad_timehost, &(ad->ad_uaddr), in authdes_refresh()
432 &(ad->ad_netid)); in authdes_refresh()
437 ad->ad_dosync = 0; in authdes_refresh()
442 ad->ad_xkey = auth->ah_key; in authdes_refresh()
443 pkey.n_bytes = (char *)(ad->ad_pkey); in authdes_refresh()
444 pkey.n_len = (u_int)strlen((char *)ad->ad_pkey) + 1; in authdes_refresh()
445 if (key_encryptsession_pk(ad->ad_servername, &pkey, &ad->ad_xkey) < 0) { in authdes_refresh()
450 cred->adc_fullname.key = ad->ad_xkey; in authdes_refresh()
452 cred->adc_fullname.name = ad->ad_fullname; in authdes_refresh()
464 struct ad_private *ad = AUTH_PRIVATE(auth); in authdes_destroy() local
466 FREE(ad->ad_fullname, ad->ad_fullnamelen + 1); in authdes_destroy()
467 FREE(ad->ad_servername, ad->ad_servernamelen + 1); in authdes_destroy()
468 if (ad->ad_timehost) in authdes_destroy()
469 FREE(ad->ad_timehost, strlen(ad->ad_timehost) + 1); in authdes_destroy()
470 if (ad->ad_netid) in authdes_destroy()
471 FREE(ad->ad_netid, strlen(ad->ad_netid) + 1); in authdes_destroy()
472 if (ad->ad_uaddr) in authdes_destroy()
473 FREE(ad->ad_uaddr, strlen(ad->ad_uaddr) + 1); in authdes_destroy()
474 FREE(ad, sizeof (struct ad_private)); in authdes_destroy()