Deleted Added
full compact
34c34
< * $FreeBSD: head/sys/security/mac_biba/mac_biba.c 115707 2003-06-02 17:21:38Z rwatson $
---
> * $FreeBSD: head/sys/security/mac_biba/mac_biba.c 116701 2003-06-23 01:26:34Z rwatson $
579,584c579,583
< * mac_biba_to_string() converts an Biba label to a string, placing the
< * results in the passed string buffer. It returns 0 on success,
< * or EINVAL if there isn't room in the buffer. The size of the
< * string appended, leaving out the nul termination, is returned to
< * the caller via *caller_len. Eventually, we should expose the
< * sbuf to the caller rather than using C strings at this layer.
---
> * mac_biba_to_string() converts a Biba label to a string, and places
> * the results in the passed sbuf. It returns 0 on success, or EINVAL
> * if there isn't room in the sbuf. Note: the sbuf will be modified
> * even in a failure case, so the caller may need to revert the sbuf
> * by restoring the offset if that's undesired.
587,588c586
< mac_biba_to_string(char *string, size_t size, size_t *caller_len,
< struct mac_biba *mac_biba)
---
> mac_biba_to_string(struct sbuf *sb, struct mac_biba *mac_biba)
590d587
< struct sbuf sb;
592,593d588
< sbuf_new(&sb, string, size, SBUF_FIXEDLEN);
<
595c590
< if (mac_biba_element_to_string(&sb, &mac_biba->mb_single)
---
> if (mac_biba_element_to_string(sb, &mac_biba->mb_single)
601c596
< if (sbuf_putc(&sb, '(') == -1)
---
> if (sbuf_putc(sb, '(') == -1)
604c599
< if (mac_biba_element_to_string(&sb, &mac_biba->mb_rangelow)
---
> if (mac_biba_element_to_string(sb, &mac_biba->mb_rangelow)
608c603
< if (sbuf_putc(&sb, '-') == -1)
---
> if (sbuf_putc(sb, '-') == -1)
611c606
< if (mac_biba_element_to_string(&sb, &mac_biba->mb_rangehigh)
---
> if (mac_biba_element_to_string(sb, &mac_biba->mb_rangehigh)
615c610
< if (sbuf_putc(&sb, ')') == -1)
---
> if (sbuf_putc(sb, ')') == -1)
619,620d613
< sbuf_finish(&sb);
< *caller_len = strlen(string);
626c619
< char *element_data, size_t size, size_t *len, int *claimed)
---
> struct sbuf *sb, int *claimed)
629d621
< int error;
637,641c629
< error = mac_biba_to_string(element_data, size, len, mac_biba);
< if (error)
< return (error);
<
< return (0);
---
> return (mac_biba_to_string(sb, mac_biba));