Lines Matching refs:ad

152 	struct ad_private *ad;  in authdes_pk_seccreate()  local
163 ad = ALLOC(struct ad_private); in authdes_pk_seccreate()
164 if (ad == NULL) { in authdes_pk_seccreate()
168 ad->ad_fullname = ad->ad_servername = NULL; /* Sanity reasons */ in authdes_pk_seccreate()
169 ad->ad_timehost = NULL; in authdes_pk_seccreate()
170 ad->ad_netid = NULL; in authdes_pk_seccreate()
171 ad->ad_uaddr = NULL; in authdes_pk_seccreate()
172 ad->ad_nis_srvr = NULL; in authdes_pk_seccreate()
173 ad->ad_timediff.tv_sec = 0; in authdes_pk_seccreate()
174 ad->ad_timediff.tv_usec = 0; in authdes_pk_seccreate()
175 memcpy(ad->ad_pkey, pkey->n_bytes, pkey->n_len); in authdes_pk_seccreate()
178 ad->ad_fullnamelen = RNDUP((u_int) strlen(namebuf)); in authdes_pk_seccreate()
179 ad->ad_fullname = (char *)mem_alloc(ad->ad_fullnamelen + 1); in authdes_pk_seccreate()
180 ad->ad_servernamelen = strlen(servername); in authdes_pk_seccreate()
181 ad->ad_servername = (char *)mem_alloc(ad->ad_servernamelen + 1); in authdes_pk_seccreate()
183 if (ad->ad_fullname == NULL || ad->ad_servername == NULL) { in authdes_pk_seccreate()
188 ad->ad_timehost = (char *)mem_alloc(strlen(timehost) + 1); in authdes_pk_seccreate()
189 if (ad->ad_timehost == NULL) { in authdes_pk_seccreate()
193 memcpy(ad->ad_timehost, timehost, strlen(timehost) + 1); in authdes_pk_seccreate()
194 ad->ad_dosync = TRUE; in authdes_pk_seccreate()
196 ad->ad_nis_srvr = srvr; /* transient */ in authdes_pk_seccreate()
197 ad->ad_dosync = TRUE; in authdes_pk_seccreate()
199 ad->ad_dosync = FALSE; in authdes_pk_seccreate()
201 memcpy(ad->ad_fullname, namebuf, ad->ad_fullnamelen + 1); in authdes_pk_seccreate()
202 memcpy(ad->ad_servername, servername, ad->ad_servernamelen + 1); in authdes_pk_seccreate()
203 ad->ad_window = window; in authdes_pk_seccreate()
220 auth->ah_private = (caddr_t)ad; in authdes_pk_seccreate()
225 ad->ad_nis_srvr = NULL; /* not needed any longer */ in authdes_pk_seccreate()
231 if (ad) { in authdes_pk_seccreate()
232 if (ad->ad_fullname) in authdes_pk_seccreate()
233 FREE(ad->ad_fullname, ad->ad_fullnamelen + 1); in authdes_pk_seccreate()
234 if (ad->ad_servername) in authdes_pk_seccreate()
235 FREE(ad->ad_servername, ad->ad_servernamelen + 1); in authdes_pk_seccreate()
236 if (ad->ad_timehost) in authdes_pk_seccreate()
237 FREE(ad->ad_timehost, strlen(ad->ad_timehost) + 1); in authdes_pk_seccreate()
238 if (ad->ad_netid) in authdes_pk_seccreate()
239 FREE(ad->ad_netid, strlen(ad->ad_netid) + 1); in authdes_pk_seccreate()
240 if (ad->ad_uaddr) in authdes_pk_seccreate()
241 FREE(ad->ad_uaddr, strlen(ad->ad_uaddr) + 1); in authdes_pk_seccreate()
242 FREE(ad, sizeof (struct ad_private)); in authdes_pk_seccreate()
270 struct ad_private *ad = AUTH_PRIVATE(auth); in authdes_marshal() local
271 struct authdes_cred *cred = &ad->ad_cred; in authdes_marshal()
272 struct authdes_verf *verf = &ad->ad_verf; in authdes_marshal()
283 (void)gettimeofday(&ad->ad_timestamp, NULL); in authdes_marshal()
284 ad->ad_timestamp.tv_sec += ad->ad_timediff.tv_sec; in authdes_marshal()
285 ad->ad_timestamp.tv_usec += ad->ad_timediff.tv_usec; in authdes_marshal()
286 while (ad->ad_timestamp.tv_usec >= USEC_PER_SEC) { in authdes_marshal()
287 ad->ad_timestamp.tv_usec -= USEC_PER_SEC; in authdes_marshal()
288 ad->ad_timestamp.tv_sec++; in authdes_marshal()
296 IXDR_PUT_INT32(ixdr, ad->ad_timestamp.tv_sec); in authdes_marshal()
297 IXDR_PUT_INT32(ixdr, ad->ad_timestamp.tv_usec); in authdes_marshal()
298 if (ad->ad_cred.adc_namekind == ADN_FULLNAME) { in authdes_marshal()
299 IXDR_PUT_U_INT32(ixdr, ad->ad_window); in authdes_marshal()
300 IXDR_PUT_U_INT32(ixdr, ad->ad_window - 1); in authdes_marshal()
314 ad->ad_verf.adv_xtimestamp = cryptbuf[0]; in authdes_marshal()
315 if (ad->ad_cred.adc_namekind == ADN_FULLNAME) { in authdes_marshal()
316 ad->ad_cred.adc_fullname.window = cryptbuf[1].key.high; in authdes_marshal()
317 ad->ad_verf.adv_winverf = cryptbuf[1].key.low; in authdes_marshal()
319 ad->ad_cred.adc_nickname = ad->ad_nickname; in authdes_marshal()
320 ad->ad_verf.adv_winverf = 0; in authdes_marshal()
327 if (ad->ad_cred.adc_namekind == ADN_FULLNAME) { in authdes_marshal()
328 len = ((1 + 1 + 2 + 1)*BYTES_PER_XDR_UNIT + ad->ad_fullnamelen); in authdes_marshal()
362 struct ad_private *ad = AUTH_PRIVATE(auth); in authdes_validate() local
399 if (bcmp((char *)&ad->ad_timestamp, (char *)&verf.adv_timestamp, in authdes_validate()
408 ad->ad_nickname = verf.adv_nickname; in authdes_validate()
409 ad->ad_cred.adc_namekind = ADN_NICKNAME; in authdes_validate()
421 struct ad_private *ad = AUTH_PRIVATE(auth); in authdes_refresh() local
422 struct authdes_cred *cred = &ad->ad_cred; in authdes_refresh()
426 if (ad->ad_dosync) { in authdes_refresh()
427 ok = __rpc_get_time_offset(&ad->ad_timediff, ad->ad_nis_srvr, in authdes_refresh()
428 ad->ad_timehost, &(ad->ad_uaddr), in authdes_refresh()
429 &(ad->ad_netid)); in authdes_refresh()
434 ad->ad_dosync = 0; in authdes_refresh()
439 ad->ad_xkey = auth->ah_key; in authdes_refresh()
440 pkey.n_bytes = (char *)(ad->ad_pkey); in authdes_refresh()
441 pkey.n_len = (u_int)strlen((char *)ad->ad_pkey) + 1; in authdes_refresh()
442 if (key_encryptsession_pk(ad->ad_servername, &pkey, &ad->ad_xkey) < 0) { in authdes_refresh()
447 cred->adc_fullname.key = ad->ad_xkey; in authdes_refresh()
449 cred->adc_fullname.name = ad->ad_fullname; in authdes_refresh()
461 struct ad_private *ad = AUTH_PRIVATE(auth); in authdes_destroy() local
463 FREE(ad->ad_fullname, ad->ad_fullnamelen + 1); in authdes_destroy()
464 FREE(ad->ad_servername, ad->ad_servernamelen + 1); in authdes_destroy()
465 if (ad->ad_timehost) in authdes_destroy()
466 FREE(ad->ad_timehost, strlen(ad->ad_timehost) + 1); in authdes_destroy()
467 if (ad->ad_netid) in authdes_destroy()
468 FREE(ad->ad_netid, strlen(ad->ad_netid) + 1); in authdes_destroy()
469 if (ad->ad_uaddr) in authdes_destroy()
470 FREE(ad->ad_uaddr, strlen(ad->ad_uaddr) + 1); in authdes_destroy()
471 FREE(ad, sizeof (struct ad_private)); in authdes_destroy()