4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1999 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #pragma ident "%Z%%M% %I% %E% SMI"
30 * SAAdverts are used internally by libslp to discover scopes in the
31 * absence of configured scopes and scopes found by active and
32 * passive DA discovery. They can also be solicited by SLPFindSrv()
33 * and SLPFindAttr calls with the "service:service-agent" type.
34 * slp_unpackSAAdvert() unpacks a SAAdvert and returns SA info.
38 #include <slp-internal.h>
40 SLPError
slp_unpackSAAdvert(char *reply
, char **surl
,
41 char **scopes
, char **attrs
) {
42 SLPError err
= SLP_OK
;
44 /* authentication components */
50 *surl
= *scopes
= *attrs
= NULL
;
52 len
= slp_get_length(reply
);
53 off
= SLP_HDRLEN
+ slp_get_langlen(reply
);
56 iov
[0].iov_base
= reply
+ off
;
58 if ((err
= slp_get_string(reply
, len
, &off
, surl
)) != SLP_OK
) {
61 iov
[0].iov_len
= off
- tmp_off
;
64 iov
[2].iov_base
= reply
+ off
;
66 if ((err
= slp_get_string(reply
, len
, &off
, scopes
)) != SLP_OK
) {
69 iov
[2].iov_len
= off
- tmp_off
;
72 iov
[1].iov_base
= reply
+ off
;
74 if ((err
= slp_get_string(reply
, len
, &off
, attrs
)) != SLP_OK
) {
77 iov
[1].iov_len
= off
- tmp_off
;
80 if ((err
= slp_get_byte(reply
, len
, &off
, &auth_cnt
)) != SLP_OK
) {
83 if (slp_get_security_on() || auth_cnt
> 0) {
84 if ((err
= slp_verify(iov
, 3,
96 if (*surl
) free(*surl
);
97 if (*scopes
) free(*scopes
);
98 if (*attrs
) free(*attrs
);