1 /*
2  * The contents of this file are subject to the terms of the
3  * Common Development and Distribution License, Version 1.0 only
4  * (the "License").  You may not use this file except in compliance
5  * with the License.
6  *
7  * See the file CDDL.Schily.txt in this distribution for details.
8  *
9  * When distributing Covered Code, include this CDDL HEADER in each
10  * file and include the License file CDDL.Schily.txt from this distribution.
11  */
12 /*
13  * @(#)change_ba.c	1.2 15/03/02 Copyright 2015 J. Schilling
14  */
15 #if defined(sun)
16 #pragma ident "@(#)change_ba.c 1.2 15/03/02 J. Schilling"
17 #endif
18 
19 #if defined(sun)
20 #pragma ident	"@(#)change_ba.c"
21 #pragma ident	"@(#)sccs:lib/comobj/change_ba.c"
22 #endif
23 # define	NEED_PRINTF_Z		/* Need defines for js_snprintf()? */
24 # include	<defines.h>
25 
26 EXPORT void
change_ba(pkt,cbuf,cbuflen)27 change_ba(pkt, cbuf, cbuflen)
28 	register struct packet	*pkt;
29 		char	*cbuf;
30 		size_t	cbuflen;
31 {
32 	char	str[SID_STRSIZE];
33 	char	urbuf[20];
34 
35 	if (!pkt->p_init_path)
36 		fatal(gettext("no initial path in data structures (co35)"));
37 
38 	urand_ba(&pkt->p_rand, urbuf, sizeof (urbuf));
39 	sid_ba(&pkt->p_reqsid, str);
40 	snprintf(cbuf, cbuflen, "%s|%s|%5.5d|%zd|%s",
41 			urbuf, str, pkt->p_ghash,
42 			strlen(pkt->p_init_path), pkt->p_init_path);
43 }
44