1/*- 2 * Copyright (c) 2004-2008 Apple Inc. 3 * Copyright (c) 2005 SPARTA, Inc. 4 * Copyright (c) 2006 Robert N. M. Watson 5 * Copyright (c) 2006 Martin Voros 6 * All rights reserved. 7 * 8 * This code was developed in part by Robert N. M. Watson, Senior Principal --- 18 unchanged lines hidden (view full) --- 27 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 31 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 32 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33 * POSSIBILITY OF SUCH DAMAGE. 34 * |
35 * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_io.c#63 $ |
36 */ 37 38#include <sys/types.h> 39 40#include <config/config.h> 41#if defined(HAVE_SYS_ENDIAN_H) && defined(HAVE_BE32ENC) 42#include <sys/endian.h> 43#else /* !HAVE_SYS_ENDIAN_H || !HAVE_BE32ENC */ --- 3127 unchanged lines hidden (view full) --- 3171 print_2_bytes(fp, ntohs(tok->tt.sockinet_ex32.port), "%u"); 3172 print_delim(fp, del); 3173 print_ip_ex_address(fp, AU_IPv6, tok->tt.sockinet_ex32.addr); 3174 } 3175} 3176 3177/* 3178 * socket family 2 bytes |
3179 * path (up to) 104 bytes + NULL (NULL terminated string). |
3180 */ 3181static int 3182fetch_sock_unix_tok(tokenstr_t *tok, u_char *buf, int len) 3183{ 3184 int err = 0; |
3185 u_char *p; 3186 int slen; |
3187 |
3188 |
3189 READ_TOKEN_U_INT16(buf, len, tok->tt.sockunix.family, tok->len, err); 3190 if (err) 3191 return (-1); 3192 |
3193 /* slen = strnlen((buf + tok->len), 104) + 1; */ 3194 p = (u_char *)memchr((const void *)(buf + tok->len), '\0', 104); 3195 slen = (p ? (int)(p - (buf + tok->len)) : 104) + 1; 3196 3197 READ_TOKEN_BYTES(buf, len, tok->tt.sockunix.path, slen, tok->len, err); |
3198 if (err) 3199 return (-1); 3200 3201 return (0); 3202} 3203 3204static void 3205print_sock_unix_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, --- 1423 unchanged lines hidden --- |