Print this page
7029 want per-process exploit mitigation features (secflags)
7030 want basic address space layout randomization (aslr)
7031 noexec_user_stack should be a secflag
7032 want a means to forbid mappings around NULL.
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/auditd_plugins/syslog/systoken.c
+++ new/usr/src/lib/auditd_plugins/syslog/systoken.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 * Copyright 2012 Milan Jurik. All rights reserved.
25 25 */
26 26
27 27
28 28 /*
29 29 * Token processing for sysupd; each token function does one
30 30 * or more operations. All of them bump the buffer pointer
31 31 * to the next token; some of them extract one or more data
32 32 * from the token.
33 33 */
34 34
35 35 #define DEBUG 0
36 36 #if DEBUG
37 37 #define DPRINT(x) { (void) fprintf x; }
38 38 #else
39 39 #define DPRINT(x)
40 40 #endif
41 41
42 42 #include <locale.h>
43 43 #include <stdlib.h>
44 44 #include <stdio.h>
45 45 #include <string.h>
46 46 #include <sys/types.h>
47 47 #include <bsm/libbsm.h>
48 48 #include <sys/tsol/label.h>
49 49 #include "toktable.h" /* ../praudit */
50 50 #include "sysplugin.h"
51 51 #include "systoken.h"
52 52 #include <audit_plugin.h>
53 53
54 54 #if DEBUG
55 55 static FILE *dbfp; /* debug file */
56 56 #endif
57 57
58 58 static void anchor_path(char *);
59 59 static size_t collapse_path(char *, size_t);
60 60 static void get_bytes_to_string(parse_context_t *, size_t *, char **,
61 61 size_t);
62 62 static void skip_bytes(parse_context_t *);
63 63 static void skip_string(parse_context_t *);
64 64 static int xgeneric(parse_context_t *);
65 65
66 66 /*
67 67 * Process a token in a record to (1) extract data of interest if any
68 68 * and (2) point to the next token.
69 69 *
70 70 * returns 0 if ok. + or - values are of debug value:
71 71 *
72 72 * returns -1 if the parsing of the token failed.
73 73 *
74 74 * returns +<previous id> if the token is not found. This value
75 75 * is used to help determine where in the record the problem
76 76 * occurred. The common failure case is that the parsing of
77 77 * token M is incorrect and the buffer pointer ends up pointing
78 78 * to garbage. The positive error value of M *may* be the id of
79 79 * the incorrectly parsed token.
80 80 */
81 81
82 82 int
83 83 parse_token(parse_context_t *ctx)
84 84 {
85 85 char tokenid;
86 86 static char prev_tokenid = -1;
87 87 int rc;
88 88
89 89 #if DEBUG
90 90 static boolean_t first = 1;
91 91
92 92 if (first) {
93 93 dbfp = __auditd_debug_file_open();
94 94 first = 0;
95 95 }
96 96 #endif
97 97
98 98 adrm_char(&(ctx->adr), &tokenid, 1);
99 99
100 100 if ((tokenid > 0) && (tokentable[tokenid].func != NOFUNC)) {
101 101 rc = (*tokentable[tokenid].func)(ctx);
102 102 prev_tokenid = tokenid;
103 103 return (rc);
104 104 }
105 105 /* here if token id is not in table */
106 106 return (prev_tokenid);
107 107 }
108 108
109 109 /* There should not be any file tokens in the middle of a record */
110 110
111 111 /* ARGSUSED */
112 112 int
113 113 file_token(parse_context_t *ctx)
114 114 {
115 115
116 116 return (-1);
117 117 }
118 118
119 119 /* ARGSUSED */
120 120 int
121 121 file64_token(parse_context_t *ctx)
122 122 {
123 123 return (-1);
124 124 }
125 125
126 126 static void
127 127 common_header(parse_context_t *ctx)
128 128 {
129 129 adrm_u_int32(&(ctx->adr), &(ctx->out.sf_reclen), 1);
130 130 ctx->adr.adr_now += sizeof (char); /* version number */
131 131 adrm_u_short(&(ctx->adr), &(ctx->out.sf_eventid), 1);
132 132 ctx->adr.adr_now += sizeof (short); /* modifier */
133 133 }
134 134
135 135 /*
136 136 * 32bit header
137 137 */
138 138 int
139 139 header_token(parse_context_t *ctx)
140 140 {
141 141 common_header(ctx);
142 142 ctx->adr.adr_now += 2 * sizeof (int32_t); /* time */
143 143
144 144 return (0);
145 145 }
146 146
147 147
148 148 int
149 149 header32_ex_token(parse_context_t *ctx)
150 150 {
151 151 int32_t type;
152 152
153 153 common_header(ctx);
154 154
155 155 adrm_int32(&(ctx->adr), &type, 1); /* tid type */
156 156 ctx->adr.adr_now += type * sizeof (char); /* ip address */
157 157
158 158 ctx->adr.adr_now += 2 * sizeof (int32_t); /* time */
159 159
160 160 return (0);
161 161 }
162 162
163 163
164 164 int
165 165 header64_ex_token(parse_context_t *ctx)
166 166 {
167 167 int32_t type;
168 168
169 169 common_header(ctx);
170 170
171 171 adrm_int32(&(ctx->adr), &type, 1); /* tid type */
172 172 ctx->adr.adr_now += type * sizeof (char); /* ip address */
173 173
174 174 ctx->adr.adr_now += 2 * sizeof (int64_t); /* time */
175 175
176 176 return (0);
177 177 }
178 178
179 179
180 180 int
181 181 header64_token(parse_context_t *ctx)
182 182 {
183 183 common_header(ctx);
184 184
185 185 ctx->adr.adr_now += 2 * sizeof (int64_t); /* time */
186 186
187 187 return (0);
188 188 }
189 189
190 190
191 191 /*
192 192 * ======================================================
193 193 * The following token processing routines return
194 194 * 0: if parsed ok
195 195 * -1: can't parse and can't determine location of next token
196 196 * ======================================================
197 197 */
198 198
199 199 int
200 200 trailer_token(parse_context_t *ctx)
201 201 {
202 202 short magic_number;
203 203 uint32_t bytes;
204 204
205 205 adrm_u_short(&(ctx->adr), (ushort_t *)&magic_number, 1);
206 206 if (magic_number != AUT_TRAILER_MAGIC)
207 207 return (-1);
208 208
209 209 adrm_u_int32(&(ctx->adr), &bytes, 1);
210 210
211 211 return (0);
212 212 }
213 213
214 214
215 215 /*
216 216 * Format of arbitrary data token:
217 217 * arbitrary data token id &(ctx->adr) char
218 218 * how to print adr_char
219 219 * basic unit adr_char
220 220 * unit count adr_char, specifying number of units of
221 221 * data items depends on basic unit
222 222 *
223 223 */
224 224 int
225 225 arbitrary_data_token(parse_context_t *ctx)
226 226 {
227 227 char basic_unit, unit_count;
228 228
229 229 ctx->adr.adr_now += sizeof (char); /* how to print */
230 230
231 231 adrm_char(&(ctx->adr), &basic_unit, 1);
232 232 adrm_char(&(ctx->adr), &unit_count, 1);
233 233
234 234 switch (basic_unit) {
235 235 case AUR_CHAR: /* same as AUR_BYTE */
236 236 ctx->adr.adr_now += unit_count * sizeof (char);
237 237 break;
238 238 case AUR_SHORT:
239 239 ctx->adr.adr_now += unit_count * sizeof (short);
240 240 break;
241 241 case AUR_INT32: /* same as AUR_INT */
242 242 ctx->adr.adr_now += unit_count * sizeof (int32_t);
243 243 break;
244 244 case AUR_INT64:
245 245 ctx->adr.adr_now += unit_count * sizeof (int64_t);
246 246 break;
247 247 default:
248 248 return (-1);
249 249 }
250 250 return (0);
251 251 }
252 252
253 253
254 254 /*
255 255 * Format of opaque token:
256 256 * opaque token id adr_char
257 257 * size adr_short
258 258 * data adr_char, size times
259 259 *
260 260 */
261 261 int
262 262 opaque_token(parse_context_t *ctx)
263 263 {
264 264 skip_bytes(ctx);
265 265 return (0);
266 266 }
267 267
268 268
269 269 /*
270 270 * Format of return32 value token:
271 271 * return value token id adr_char
272 272 * error number adr_char
273 273 * return value adr_u_int32
274 274 *
275 275 */
276 276 int
277 277 return_value32_token(parse_context_t *ctx)
278 278 {
279 279 char errnum;
280 280
281 281 adrm_char(&(ctx->adr), &errnum, 1); /* pass / fail */
282 282 ctx->adr.adr_now += sizeof (int32_t); /* error code */
283 283
284 284 ctx->out.sf_pass = (errnum == 0) ? 1 : -1;
285 285
286 286 return (0);
287 287 }
288 288
289 289 /*
290 290 * Format of return64 value token:
291 291 * return value token id adr_char
292 292 * error number adr_char
293 293 * return value adr_u_int64
294 294 *
295 295 */
296 296 int
297 297 return_value64_token(parse_context_t *ctx)
298 298 {
299 299 char errnum;
300 300
301 301 adrm_char(&(ctx->adr), &errnum, 1); /* pass / fail */
302 302 ctx->adr.adr_now += sizeof (int64_t); /* error code */
303 303
304 304 ctx->out.sf_pass = (errnum == 0) ? 1 : -1;
305 305
306 306 return (0);
307 307 }
308 308
309 309
310 310 /*
311 311 * Format of sequence token:
312 312 * sequence token id adr_char
313 313 * audit_count int32_t
314 314 *
315 315 */
316 316 int
317 317 sequence_token(parse_context_t *ctx)
318 318 {
319 319 adrm_int32(&(ctx->adr), &(ctx->out.sf_sequence), 1);
320 320 return (0);
321 321 }
322 322
323 323
324 324 /*
325 325 * Format of text token:
326 326 * text token id adr_char
327 327 * text adr_string
328 328 */
329 329 int
330 330 text_token(parse_context_t *ctx)
331 331 {
332 332 ushort_t len;
333 333 size_t separator_sz = 0;
334 334 char *bp; /* pointer to output string */
335 335
336 336 adrm_u_short(&(ctx->adr), &len, 1);
337 337
338 338 if (ctx->out.sf_textlen > 0)
339 339 separator_sz = sizeof (AU_TEXT_NAME) - 1;
340 340
341 341 DPRINT((dbfp, "text_token: start length=%d, add length=%d+%d\n",
342 342 ctx->out.sf_textlen, (size_t)len, separator_sz));
343 343
344 344 ctx->out.sf_text = realloc(ctx->out.sf_text,
345 345 ctx->out.sf_textlen + (size_t)len + separator_sz);
346 346
347 347 if (ctx->out.sf_text == NULL)
348 348 return (-1);
349 349
350 350 bp = ctx->out.sf_text;
351 351
352 352 if (ctx->out.sf_textlen != 0) { /* concatenation? */
353 353 bp += ctx->out.sf_textlen;
354 354 bp += strlcpy(bp, AU_TEXT_NAME, separator_sz + 1);
355 355 ctx->out.sf_textlen += separator_sz;
356 356 DPRINT((dbfp, "text_token: l is %d\n%s\n", ctx->out.sf_textlen,
357 357 ctx->out.sf_text));
358 358 }
359 359 adrm_char(&(ctx->adr), bp, len);
360 360 len--; /* includes EOS */
361 361 *(bp + len) = '\0';
362 362
363 363 ctx->out.sf_textlen += len;
364 364 DPRINT((dbfp, "text_token: l=%d\n%s\n", ctx->out.sf_textlen,
365 365 ctx->out.sf_text));
366 366
367 367 return (0);
368 368 }
369 369
370 370 /*
371 371 * Format of tid token:
372 372 * ip token id adr_char
373 373 * terminal type adr_char
374 374 * terminal type = AU_IPADR:
375 375 * remote port: ushort
376 376 * local port: ushort
377 377 * IP type: int32 -- AU_IPv4 or AU_IPv6
378 378 * address: int32 if IPv4, else 4 * int32
379 379 */
380 380 int
381 381 tid_token(parse_context_t *ctx)
382 382 {
383 383 uchar_t type;
384 384 int32_t ip_length;
385 385
386 386 adrm_char(&(ctx->adr), (char *)&type, 1);
387 387
388 388 switch (type) {
389 389 default:
390 390 return (-1); /* other than IP type is not implemented */
391 391 case AU_IPADR:
392 392 ctx->adr.adr_now += 2 * sizeof (ushort_t);
393 393 adrm_int32(&(ctx->adr), &ip_length, 1);
394 394 ctx->adr.adr_now += ip_length;
395 395 break;
396 396 }
397 397 return (0);
398 398 }
399 399
400 400 /*
401 401 * Format of ip_addr token:
402 402 * ip token id adr_char
403 403 * address adr_int32
404 404 *
405 405 */
406 406 int
407 407 ip_addr_token(parse_context_t *ctx)
408 408 {
409 409 ctx->adr.adr_now += sizeof (int32_t);
410 410
411 411 return (0);
412 412 }
413 413
414 414 /*
415 415 * Format of ip_addr_ex token:
416 416 * ip token id adr_char
417 417 * ip type adr_int32
418 418 * ip address adr_u_char*type
419 419 *
420 420 */
421 421 int
422 422 ip_addr_ex_token(parse_context_t *ctx)
423 423 {
424 424 int32_t type;
425 425
426 426 adrm_int32(&(ctx->adr), &type, 1); /* ip type */
427 427 ctx->adr.adr_now += type * sizeof (uchar_t); /* ip address */
428 428
429 429 return (0);
430 430 }
431 431
432 432 /*
433 433 * Format of ip token:
434 434 * ip header token id adr_char
435 435 * version adr_char
436 436 * type of service adr_char
437 437 * length adr_short
438 438 * id adr_u_short
439 439 * offset adr_u_short
440 440 * ttl adr_char
441 441 * protocol adr_char
442 442 * checksum adr_u_short
443 443 * source address adr_int32
444 444 * destination address adr_int32
445 445 *
446 446 */
447 447 int
448 448 ip_token(parse_context_t *ctx)
449 449 {
450 450 ctx->adr.adr_now += (2 * sizeof (char)) + (3 * sizeof (short)) +
451 451 (2 * sizeof (char)) + sizeof (short) + (2 * sizeof (int32_t));
452 452 return (0);
453 453 }
454 454
455 455
456 456 /*
457 457 * Format of iport token:
458 458 * ip port address token id adr_char
459 459 * port address adr_short
460 460 *
461 461 */
462 462 int
463 463 iport_token(parse_context_t *ctx)
464 464 {
465 465 ctx->adr.adr_now += sizeof (short);
466 466
467 467 return (0);
468 468 }
469 469
470 470
471 471 /*
472 472 * Format of groups token:
473 473 * group token id adr_char
474 474 * group list adr_int32, 16 times
475 475 *
476 476 */
477 477 int
478 478 group_token(parse_context_t *ctx)
479 479 {
480 480 ctx->adr.adr_now += 16 * sizeof (int32_t);
481 481
482 482 return (0);
483 483 }
484 484
485 485 /*
486 486 * Format of newgroups token:
487 487 * group token id adr_char
488 488 * number of groups adr_short
489 489 * group list adr_int32, "number" times
490 490 *
491 491 */
492 492 int
493 493 newgroup_token(parse_context_t *ctx)
494 494 {
495 495 short int number;
496 496
497 497 adrm_short(&(ctx->adr), &number, 1);
498 498
499 499 ctx->adr.adr_now += number * sizeof (int32_t);
500 500
501 501 return (0);
502 502 }
503 503
504 504 /*
505 505 * Format of argument32 token:
506 506 * argument token id adr_char
507 507 * argument number adr_char
508 508 * argument value adr_int32
509 509 * argument description adr_string
510 510 *
511 511 */
512 512 int
513 513 argument32_token(parse_context_t *ctx)
514 514 {
515 515 ctx->adr.adr_now += sizeof (char) + sizeof (int32_t);
516 516 skip_bytes(ctx);
517 517
518 518 return (0);
519 519 }
520 520
521 521 /*
522 522 * Format of argument64 token:
523 523 * argument token id adr_char
524 524 * argument number adr_char
525 525 * argument value adr_int64
526 526 * argument description adr_string
527 527 *
528 528 */
529 529 int
530 530 argument64_token(parse_context_t *ctx)
531 531 {
532 532 ctx->adr.adr_now += sizeof (char) + sizeof (int64_t);
533 533 skip_bytes(ctx);
534 534
535 535 return (0);
536 536 }
537 537
538 538 /*
539 539 * Format of acl token:
540 540 * acl token id adr_char
541 541 * type adr_u_int32
542 542 * value adr_u_int32
543 543 * mode adr_u_int32
544 544 */
545 545 int
546 546 acl_token(parse_context_t *ctx)
547 547 {
548 548 ctx->adr.adr_now += 3 * sizeof (uint32_t);
549 549
550 550 return (0);
551 551 }
552 552
553 553 /*
554 554 * Format of ace token:
555 555 * ace token id adr_char
556 556 * id adr_u_int32
557 557 * access_mask adr_u_int32
558 558 * flags adr_u_short
559 559 * type adr_u_short
560 560 */
561 561 int
562 562 ace_token(parse_context_t *ctx)
563 563 {
564 564 ctx->adr.adr_now += 2 * sizeof (uint32_t) + 2 * sizeof (ushort_t);
565 565
566 566 return (0);
567 567 }
568 568
569 569 /*
570 570 * Format of attribute token: (old pre SunOS 5.7 format)
571 571 * attribute token id adr_char
572 572 * mode adr_int32 (printed in octal)
573 573 * uid adr_int32
574 574 * gid adr_int32
575 575 * file system id adr_int32
576 576 * node id adr_int32
577 577 * device adr_int32
578 578 *
579 579 */
580 580 int
581 581 attribute_token(parse_context_t *ctx)
582 582 {
583 583 ctx->adr.adr_now += 6 * sizeof (int32_t);
584 584
585 585 return (0);
586 586 }
587 587
588 588 /*
589 589 * Format of attribute32 token:
590 590 * attribute token id adr_char
591 591 * mode adr_int32 (printed in octal)
592 592 * uid adr_int32
593 593 * gid adr_int32
594 594 * file system id adr_int32
595 595 * node id adr_int64
596 596 * device adr_int32
597 597 *
598 598 */
599 599 int
600 600 attribute32_token(parse_context_t *ctx)
601 601 {
602 602 ctx->adr.adr_now += (5 * sizeof (int32_t)) + sizeof (int64_t);
603 603
604 604 return (0);
605 605 }
606 606
607 607 /*
608 608 * Format of attribute64 token:
609 609 * attribute token id adr_char
610 610 * mode adr_int32 (printed in octal)
611 611 * uid adr_int32
612 612 * gid adr_int32
613 613 * file system id adr_int32
614 614 * node id adr_int64
615 615 * device adr_int64
616 616 *
617 617 */
618 618 int
619 619 attribute64_token(parse_context_t *ctx)
620 620 {
621 621 ctx->adr.adr_now += (4 * sizeof (int32_t)) + (2 * sizeof (int64_t));
622 622
623 623 return (0);
624 624 }
625 625
626 626
627 627 /*
628 628 * Format of command token:
629 629 * attribute token id adr_char
630 630 * argc adr_short
631 631 * argv len adr_short variable amount of argv len
632 632 * argv text argv len and text
633 633 * .
634 634 * .
635 635 * .
636 636 * envp count adr_short variable amount of envp len
637 637 * envp len adr_short and text
638 638 * envp text envp len
639 639 * .
640 640 * .
641 641 * .
642 642 *
643 643 */
644 644 int
645 645 cmd_token(parse_context_t *ctx)
646 646 {
647 647 short cnt;
648 648 short i;
649 649
650 650 adrm_short(&(ctx->adr), &cnt, 1);
651 651
652 652 for (i = 0; i < cnt; i++)
653 653 skip_bytes(ctx);
654 654
655 655 adrm_short(&(ctx->adr), &cnt, 1);
656 656
657 657 for (i = 0; i < cnt; i++)
658 658 skip_bytes(ctx);
659 659
660 660 return (0);
661 661 }
662 662
663 663
664 664 /*
665 665 * Format of exit token:
666 666 * attribute token id adr_char
667 667 * return value adr_int32
668 668 * errno adr_int32
669 669 *
670 670 */
671 671 int
672 672 exit_token(parse_context_t *ctx)
673 673 {
674 674 int32_t retval;
675 675
676 676 adrm_int32(&(ctx->adr), &retval, 1);
677 677 ctx->adr.adr_now += sizeof (int32_t);
678 678
679 679 ctx->out.sf_pass = (retval == 0) ? 1 : -1;
680 680 return (0);
681 681 }
682 682
683 683 /*
684 684 * Format of exec_args token:
685 685 * attribute token id adr_char
686 686 * count value adr_int32
687 687 * strings null terminated strings
688 688 *
689 689 */
690 690 int
691 691 exec_args_token(parse_context_t *ctx)
692 692 {
693 693 int count, i;
694 694
695 695 adrm_int32(&(ctx->adr), (int32_t *)&count, 1);
696 696 for (i = 1; i <= count; i++) {
697 697 skip_string(ctx);
698 698 }
699 699
700 700 return (0);
701 701 }
702 702
703 703 /*
704 704 * Format of exec_env token:
705 705 * attribute token id adr_char
706 706 * count value adr_int32
707 707 * strings null terminated strings
708 708 *
709 709 */
710 710 int
711 711 exec_env_token(parse_context_t *ctx)
712 712 {
713 713 int count, i;
714 714
715 715 adrm_int32(&(ctx->adr), (int32_t *)&count, 1);
716 716 for (i = 1; i <= count; i++)
717 717 skip_string(ctx);
718 718
719 719 return (0);
720 720 }
721 721
722 722 /*
723 723 * Format of liaison token:
724 724 */
725 725 int
726 726 liaison_token(parse_context_t *ctx)
727 727 {
728 728 ctx->adr.adr_now += sizeof (int32_t);
729 729
730 730 return (0);
731 731 }
732 732
733 733
734 734 /*
735 735 * Format of path token:
736 736 * path adr_string
737 737 */
738 738 int
739 739 path_token(parse_context_t *ctx)
740 740 {
741 741 get_bytes_to_string(ctx, &(ctx->out.sf_pathlen), &(ctx->out.sf_path),
742 742 0);
743 743 if (ctx->out.sf_path == NULL)
744 744 return (-1);
745 745 /*
746 746 * anchor the path because collapse_path needs it
747 747 */
748 748 if (*(ctx->out.sf_path) != '/') {
749 749 anchor_path(ctx->out.sf_path);
750 750 ctx->out.sf_pathlen++;
751 751 }
752 752 ctx->out.sf_pathlen = collapse_path(ctx->out.sf_path,
753 753 ctx->out.sf_pathlen);
754 754
755 755 return (0);
756 756 }
757 757
758 758 /*
759 759 * path attr token / AUT_XATPATH
760 760 *
761 761 * Format of path attr token:
762 762 * token id adr_char
763 763 * string count adr_int32
764 764 * strings adr_string
765 765 *
766 766 * the sequence of strings is converted to a single string with
767 767 * a blank separator replacing the EOS for all but the last
768 768 * string.
769 769 */
770 770 int
771 771 path_attr_token(parse_context_t *ctx)
772 772 {
773 773 int count, i;
774 774 int last_len;
775 775 size_t offset;
776 776 char *p;
777 777
778 778 adrm_int32(&(ctx->adr), &count, 1);
779 779
780 780 offset = ctx->out.sf_atpathlen;
781 781 p = ctx->adr.adr_now;
782 782 for (i = 0; i <= count; i++) {
783 783 last_len = strlen(p);
784 784 ctx->out.sf_atpathlen += last_len + 1;
785 785 p += last_len + 1;
786 786 }
787 787 ctx->out.sf_atpath = realloc(ctx->out.sf_atpath, ctx->out.sf_atpathlen);
788 788 ctx->out.sf_atpath += offset;
789 789 p = ctx->out.sf_atpath; /* save for fix up, below */
790 790 (void) memcpy(ctx->out.sf_atpath, ctx->adr.adr_now,
791 791 ctx->out.sf_atpathlen - offset);
792 792 ctx->out.sf_atpathlen--;
793 793
794 794 /* fix up: replace each eos except the last with ' ' */
795 795
796 796 for (i = 0; i < count; i++) {
797 797 while (*p++ != '\0')
798 798 ;
799 799 *(p - 1) = ' ';
800 800 }
801 801 return (0);
802 802 }
803 803
804 804
805 805 /*
806 806 * Format of System V IPC permission token:
807 807 * System V IPC permission token id adr_char
808 808 * uid adr_int32
809 809 * gid adr_int32
810 810 * cuid adr_int32
811 811 * cgid adr_int32
812 812 * mode adr_int32
813 813 * seq adr_int32
814 814 * key adr_int32
815 815 */
816 816 int
817 817 s5_IPC_perm_token(parse_context_t *ctx)
818 818 {
819 819 ctx->adr.adr_now += (7 * sizeof (int32_t));
820 820 return (0);
821 821 }
822 822
823 823 static void
824 824 common_process(parse_context_t *ctx)
825 825 {
826 826 int32_t ruid, rgid, egid, pid;
827 827 uint32_t asid;
828 828
829 829 adrm_u_int32(&(ctx->adr), (uint32_t *)&(ctx->out.sf_pauid), 1);
830 830 adrm_u_int32(&(ctx->adr), (uint32_t *)&(ctx->out.sf_peuid), 1);
831 831 adrm_int32(&(ctx->adr), &egid, 1);
832 832 adrm_int32(&(ctx->adr), &ruid, 1);
833 833 adrm_int32(&(ctx->adr), &rgid, 1);
834 834 adrm_int32(&(ctx->adr), &pid, 1);
835 835 adrm_u_int32(&(ctx->adr), &asid, 1);
836 836 }
837 837
838 838 /*
839 839 * Format of process32 token:
840 840 * process token id adr_char
841 841 * auid adr_int32
842 842 * euid adr_int32
843 843 * egid adr_int32
844 844 * ruid adr_int32
845 845 * rgid adr_int32
846 846 * pid adr_int32
847 847 * sid adr_int32
848 848 * termid adr_int32*2
849 849 *
850 850 */
851 851 int
852 852 process32_token(parse_context_t *ctx)
853 853 {
854 854 int32_t port, machine;
855 855
856 856 common_process(ctx);
857 857
858 858 adrm_int32(&(ctx->adr), &port, 1);
859 859 adrm_int32(&(ctx->adr), &machine, 1);
860 860
861 861 return (0);
862 862 }
863 863
864 864 /*
865 865 * Format of process32_ex token:
866 866 * process token id adr_char
867 867 * auid adr_int32
868 868 * euid adr_int32
869 869 * egid adr_int32
870 870 * ruid adr_int32
871 871 * rgid adr_int32
872 872 * pid adr_int32
873 873 * sid adr_int32
874 874 * termid
875 875 * port adr_int32
876 876 * type adr_int32
877 877 * ip address adr_u_char*type
878 878 *
879 879 */
880 880 int
881 881 process32_ex_token(parse_context_t *ctx)
882 882 {
883 883 int32_t port, type;
884 884 uchar_t addr[16];
885 885
886 886 common_process(ctx);
887 887
888 888 adrm_int32(&(ctx->adr), &port, 1);
889 889 adrm_int32(&(ctx->adr), &type, 1);
890 890 adrm_u_char(&(ctx->adr), addr, type);
891 891
892 892 return (0);
893 893 }
894 894
895 895 /*
896 896 * Format of process64 token:
897 897 * process token id adr_char
898 898 * auid adr_int32
899 899 * euid adr_int32
900 900 * egid adr_int32
901 901 * ruid adr_int32
902 902 * rgid adr_int32
903 903 * pid adr_int32
904 904 * sid adr_int32
905 905 * termid adr_int64+adr_int32
906 906 *
907 907 */
908 908 int
909 909 process64_token(parse_context_t *ctx)
910 910 {
911 911 int64_t port;
912 912 int32_t machine;
913 913
914 914 common_process(ctx);
915 915
916 916 adrm_int64(&(ctx->adr), &port, 1);
917 917 adrm_int32(&(ctx->adr), &machine, 1);
918 918
919 919 return (0);
920 920 }
921 921
922 922 /*
923 923 * Format of process64_ex token:
924 924 * process token id adr_char
925 925 * auid adr_int32
926 926 * euid adr_int32
927 927 * egid adr_int32
928 928 * ruid adr_int32
929 929 * rgid adr_int32
930 930 * pid adr_int32
931 931 * sid adr_int32
932 932 * termid
933 933 * port adr_int64
934 934 * type adr_int32
935 935 * ip address adr_u_char*type
936 936 *
937 937 */
938 938 int
939 939 process64_ex_token(parse_context_t *ctx)
940 940 {
941 941 int64_t port;
942 942 int32_t type;
943 943 uchar_t addr[16];
944 944
945 945 common_process(ctx);
946 946
947 947 adrm_int64(&(ctx->adr), &port, 1);
948 948 adrm_int32(&(ctx->adr), &type, 1);
949 949 adrm_u_char(&(ctx->adr), addr, type);
950 950
951 951 return (0);
952 952 }
953 953
954 954 /*
955 955 * Format of System V IPC token:
956 956 * System V IPC token id adr_char
957 957 * System V IPC type adr_char
958 958 * object id adr_int32
959 959 *
960 960 */
961 961 int
962 962 s5_IPC_token(parse_context_t *ctx)
963 963 {
964 964 ctx->adr.adr_now += sizeof (char);
965 965 ctx->adr.adr_now += sizeof (int32_t);
966 966
967 967 return (0);
968 968 }
969 969
970 970
971 971 /*
972 972 * Format of socket token:
973 973 * socket_type adrm_short
974 974 * remote_port adrm_short
975 975 * remote_inaddr adrm_int32
976 976 *
977 977 */
978 978 int
979 979 socket_token(parse_context_t *ctx)
980 980 {
981 981 ctx->adr.adr_now += (2 * sizeof (short)) + sizeof (int32_t);
982 982
983 983 return (0);
984 984 }
985 985
986 986
987 987 /*
988 988 * Format of socket_ex token:
989 989 * socket_domain adrm_short
990 990 * socket_type adrm_short
991 991 * address_type adrm_short
992 992 * local_port adrm_short
993 993 * local_inaddr adrm_u_char*address_type
994 994 * remote_port adrm_short
995 995 * remote_inaddr adrm_u_char*address_type
996 996 *
997 997 */
998 998 int
999 999 socket_ex_token(parse_context_t *ctx)
1000 1000 {
1001 1001 short ip_size;
1002 1002
1003 1003 ctx->adr.adr_now += (2 * sizeof (short));
1004 1004 adrm_short(&(ctx->adr), &ip_size, 1);
1005 1005
1006 1006 ctx->adr.adr_now += sizeof (short) + (ip_size * sizeof (char)) +
1007 1007 sizeof (short) + (ip_size * sizeof (char));
1008 1008 return (0);
1009 1009 }
1010 1010
1011 1011
1012 1012 static void
1013 1013 common_subject(parse_context_t *ctx)
1014 1014 {
1015 1015 int32_t ruid, rgid, pid;
1016 1016
1017 1017 adrm_u_int32(&(ctx->adr), (uint32_t *)&(ctx->out.sf_auid), 1);
1018 1018 adrm_u_int32(&(ctx->adr), (uint32_t *)&(ctx->out.sf_euid), 1);
1019 1019 adrm_u_int32(&(ctx->adr), (uint32_t *)&(ctx->out.sf_egid), 1);
1020 1020 adrm_int32(&(ctx->adr), &ruid, 1);
1021 1021 adrm_int32(&(ctx->adr), &rgid, 1);
1022 1022 adrm_int32(&(ctx->adr), &pid, 1);
1023 1023 adrm_u_int32(&(ctx->adr), (uint32_t *)&(ctx->out.sf_asid), 1);
1024 1024 }
1025 1025
1026 1026 /*
1027 1027 * Format of subject32 token:
1028 1028 * subject token id adr_char
1029 1029 * auid adr_int32
1030 1030 * euid adr_int32
1031 1031 * egid adr_int32
1032 1032 * ruid adr_int32
1033 1033 * rgid adr_int32
1034 1034 * pid adr_int32
1035 1035 * sid adr_int32
1036 1036 * termid adr_int32*2
1037 1037 *
1038 1038 */
1039 1039 int
1040 1040 subject32_token(parse_context_t *ctx)
1041 1041 {
1042 1042 int32_t port; /* not used in output */
1043 1043
1044 1044 common_subject(ctx);
1045 1045
1046 1046 adrm_int32(&(ctx->adr), &port, 1);
1047 1047 ctx->out.sf_tid.at_type = AU_IPv4;
1048 1048 adrm_u_char(&(ctx->adr), (uchar_t *)&(ctx->out.sf_tid.at_addr[0]), 4);
1049 1049
1050 1050 return (0);
1051 1051 }
1052 1052
1053 1053 /*
1054 1054 * Format of subject32_ex token:
1055 1055 * subject token id adr_char
1056 1056 * auid adr_int32
1057 1057 * euid adr_int32
1058 1058 * egid adr_int32
1059 1059 * ruid adr_int32
1060 1060 * rgid adr_int32
1061 1061 * pid adr_int32
1062 1062 * sid adr_int32
1063 1063 * termid
1064 1064 * port adr_int32
1065 1065 * type adr_int32
1066 1066 * ip address adr_u_char*type
1067 1067 *
1068 1068 */
1069 1069 int
1070 1070 subject32_ex_token(parse_context_t *ctx)
1071 1071 {
1072 1072 int32_t port; /* not used in output */
1073 1073
1074 1074 common_subject(ctx);
1075 1075
1076 1076 adrm_int32(&(ctx->adr), &port, 1);
1077 1077 adrm_u_int32(&(ctx->adr), &(ctx->out.sf_tid.at_type), 1);
1078 1078 adrm_u_char(&(ctx->adr), (uchar_t *)&(ctx->out.sf_tid.at_addr[0]),
1079 1079 ctx->out.sf_tid.at_type);
1080 1080
1081 1081 return (0);
1082 1082 }
1083 1083
1084 1084 /*
1085 1085 * Format of subject64 token:
1086 1086 * subject token id adr_char
1087 1087 * auid adr_int32
1088 1088 * euid adr_int32
1089 1089 * egid adr_int32
1090 1090 * ruid adr_int32
1091 1091 * rgid adr_int32
1092 1092 * pid adr_int32
1093 1093 * sid adr_int32
1094 1094 * termid adr_int64+adr_int32
1095 1095 *
1096 1096 */
1097 1097 int
1098 1098 subject64_token(parse_context_t *ctx)
1099 1099 {
1100 1100 int64_t port;
1101 1101
1102 1102 common_subject(ctx);
1103 1103
1104 1104 adrm_int64(&(ctx->adr), &port, 1);
1105 1105 ctx->out.sf_tid.at_type = AU_IPv4;
1106 1106 adrm_u_char(&(ctx->adr), (uchar_t *)&(ctx->out.sf_tid.at_addr[0]), 4);
1107 1107
1108 1108 return (0);
1109 1109 }
1110 1110
1111 1111 /*
1112 1112 * Format of subject64_ex token:
1113 1113 * subject token id adr_char
1114 1114 * auid adr_int32
1115 1115 * euid adr_int32
1116 1116 * egid adr_int32
1117 1117 * ruid adr_int32
1118 1118 * rgid adr_int32
1119 1119 * pid adr_int32
1120 1120 * sid adr_int32
1121 1121 * termid
1122 1122 * port adr_int64
1123 1123 * type adr_int32
1124 1124 * ip address adr_u_char*type
1125 1125 *
1126 1126 */
1127 1127 int
1128 1128 subject64_ex_token(parse_context_t *ctx)
1129 1129 {
1130 1130 int64_t port;
1131 1131
1132 1132 common_subject(ctx);
1133 1133
1134 1134 adrm_int64(&(ctx->adr), &port, 1);
1135 1135 adrm_u_int32(&(ctx->adr), &(ctx->out.sf_tid.at_type), 1);
1136 1136 adrm_u_char(&(ctx->adr), (uchar_t *)&(ctx->out.sf_tid.at_addr[0]),
1137 1137 ctx->out.sf_tid.at_type);
1138 1138
1139 1139 return (0);
1140 1140 }
1141 1141
1142 1142
1143 1143 int
1144 1144 xatom_token(parse_context_t *ctx)
1145 1145 {
1146 1146 skip_bytes(ctx);
1147 1147
1148 1148 return (0);
1149 1149 }
1150 1150
1151 1151
1152 1152 int
1153 1153 xselect_token(parse_context_t *ctx)
1154 1154 {
1155 1155 skip_bytes(ctx);
1156 1156 skip_bytes(ctx);
1157 1157 skip_bytes(ctx);
1158 1158
1159 1159 return (0);
1160 1160 }
1161 1161
1162 1162 /*
1163 1163 * anchor a path name with a slash
1164 1164 * assume we have enough space
1165 1165 */
1166 1166 static void
1167 1167 anchor_path(char *path)
1168 1168 {
1169 1169
1170 1170 (void) memmove((void *)(path + 1), (void *)path, strlen(path) + 1);
1171 1171 *path = '/';
1172 1172 }
1173 1173
1174 1174
1175 1175 /*
1176 1176 * copy path to collapsed path.
1177 1177 * collapsed path does not contain:
1178 1178 * successive slashes
1179 1179 * instances of dot-slash
1180 1180 * instances of dot-dot-slash
1181 1181 * passed path must be anchored with a '/'
1182 1182 */
1183 1183 static size_t
1184 1184 collapse_path(char *s, size_t ls)
1185 1185 {
1186 1186 int id; /* index of where we are in destination string */
1187 1187 int is; /* index of where we are in source string */
1188 1188 int slashseen; /* have we seen a slash */
1189 1189
1190 1190 ls++; /* source length including '\0' */
1191 1191
1192 1192 slashseen = 0;
1193 1193 for (is = 0, id = 0; is < ls; is++) {
1194 1194 if (s[is] == '\0') {
1195 1195 if (id > 1 && s[id-1] == '/') {
1196 1196 --id;
1197 1197 }
1198 1198 s[id++] = '\0';
1199 1199 break;
1200 1200 }
1201 1201 /* previous character was a / */
1202 1202 if (slashseen) {
1203 1203 if (s[is] == '/')
1204 1204 continue; /* another slash, ignore it */
1205 1205 } else if (s[is] == '/') {
1206 1206 /* we see a /, just copy it and try again */
1207 1207 slashseen = 1;
1208 1208 s[id++] = '/';
1209 1209 continue;
1210 1210 }
1211 1211 /* /./ seen */
1212 1212 if (s[is] == '.' && s[is+1] == '/') {
1213 1213 is += 1;
1214 1214 continue;
1215 1215 }
1216 1216 /* XXX/. seen */
1217 1217 if (s[is] == '.' && s[is+1] == '\0') {
1218 1218 if (id > 1)
1219 1219 id--;
1220 1220 continue;
1221 1221 }
1222 1222 /* XXX/.. seen */
1223 1223 if (s[is] == '.' && s[is+1] == '.' && s[is+2] == '\0') {
1224 1224 is += 1;
1225 1225 if (id > 0)
1226 1226 id--;
1227 1227 while (id > 0 && s[--id] != '/')
1228 1228 ;
1229 1229 id++;
1230 1230 continue;
1231 1231 }
1232 1232 /* XXX/../ seen */
1233 1233 if (s[is] == '.' && s[is+1] == '.' && s[is+2] == '/') {
1234 1234 is += 2;
1235 1235 if (id > 0)
1236 1236 id--;
1237 1237 while (id > 0 && s[--id] != '/')
1238 1238 ;
1239 1239 id++;
1240 1240 continue;
1241 1241 }
1242 1242 while (is < ls && (s[id++] = s[is++]) != '/')
1243 1243 ;
1244 1244 is--;
1245 1245 }
1246 1246 return ((size_t)id - 1);
1247 1247 }
1248 1248
1249 1249 /*
1250 1250 * for tokens with sub-fields that include a length, this
1251 1251 * skips the sub-field.
1252 1252 */
1253 1253
1254 1254 static void
1255 1255 skip_bytes(parse_context_t *ctx)
1256 1256 {
1257 1257 ushort_t c;
1258 1258
1259 1259 adrm_u_short(&(ctx->adr), &c, 1);
1260 1260 ctx->adr.adr_now += c;
1261 1261 }
1262 1262
1263 1263 static void
1264 1264 skip_string(parse_context_t *ctx)
1265 1265 {
1266 1266 char c;
1267 1267
1268 1268 do {
1269 1269 adrm_char(&(ctx->adr), &c, 1);
1270 1270 } while (c != (char)0);
1271 1271 }
1272 1272
1273 1273 /*
1274 1274 * add a byte to specified length so there can be a prefix of
1275 1275 * '/' added (if needed for paths). Another is added for '\0'
1276 1276 *
1277 1277 * if offset is zero, new data overwrites old, if any. Otherwise
1278 1278 * new data is appended to the end.
1279 1279 */
1280 1280
1281 1281 static void
1282 1282 get_bytes_to_string(parse_context_t *ctx, size_t *l, char **p,
1283 1283 size_t offset)
1284 1284 {
1285 1285 ushort_t len;
1286 1286 char *bp;
1287 1287
1288 1288 adrm_u_short(&(ctx->adr), &len, 1);
1289 1289
1290 1290 len++; /* in case need to add '/' prefix */
1291 1291 *p = realloc(*p, 1 + (size_t)len + offset);
1292 1292 if (*p == NULL) {
1293 1293 perror("audit_sysudp.so");
1294 1294 return;
1295 1295 }
1296 1296 if (offset > 0)
1297 1297 offset--; /* overwrite end of string */
1298 1298
1299 1299 *l = (size_t)len - 2 + offset;
1300 1300
1301 1301 bp = *p + offset;
1302 1302 adrm_char(&(ctx->adr), bp, len - 1);
1303 1303 *(bp + len - 1) = '\0';
1304 1304 }
1305 1305
1306 1306
1307 1307 /*
1308 1308 * Format of host token:
1309 1309 * host adr_uint32
1310 1310 */
1311 1311 int
1312 1312 host_token(parse_context_t *ctx)
1313 1313 {
1314 1314 ctx->adr.adr_now += sizeof (int32_t);
1315 1315
1316 1316 return (0);
1317 1317 }
1318 1318
1319 1319 /*
1320 1320 * Format of useofauth token:
1321 1321 * uauth token id adr_char
1322 1322 * uauth adr_string
1323 1323 *
1324 1324 */
1325 1325 int
1326 1326 useofauth_token(parse_context_t *ctx)
1327 1327 {
1328 1328 get_bytes_to_string(ctx, &(ctx->out.sf_uauthlen),
1329 1329 &(ctx->out.sf_uauth), 0);
1330 1330
1331 1331 return (0);
1332 1332 }
1333 1333
1334 1334 /*
1335 1335 * Format of user token:
1336 1336 * user token id adr_char
1337 1337 * uid adr_uid
1338 1338 * username adr_string
1339 1339 *
1340 1340 */
1341 1341 int
1342 1342 user_token(parse_context_t *ctx)
1343 1343 {
1344 1344 ctx->adr.adr_now += sizeof (uid_t);
1345 1345 skip_bytes(ctx);
1346 1346
1347 1347 return (0);
1348 1348 }
1349 1349
1350 1350 /*
1351 1351 * Format of zonename token:
1352 1352 * zonename token id adr_char
1353 1353 * zonename adr_string
1354 1354 *
1355 1355 */
1356 1356 int
1357 1357 zonename_token(parse_context_t *ctx)
1358 1358 {
1359 1359 get_bytes_to_string(ctx,
1360 1360 &(ctx->out.sf_zonelen),
1361 1361 &(ctx->out.sf_zonename),
1362 1362 0);
1363 1363
1364 1364 return (0);
1365 1365 }
1366 1366
1367 1367 /*
1368 1368 * Format of fmri token:
1369 1369 * fmri token id adr_char
1370 1370 * fmri adr_string
1371 1371 */
1372 1372 int
1373 1373 fmri_token(parse_context_t *ctx)
1374 1374 {
1375 1375 skip_bytes(ctx);
1376 1376
1377 1377 return (0);
1378 1378 }
1379 1379
1380 1380 int
1381 1381 xcolormap_token(parse_context_t *ctx)
1382 1382 {
1383 1383 return (xgeneric(ctx));
1384 1384 }
1385 1385
1386 1386 int
1387 1387 xcursor_token(parse_context_t *ctx)
1388 1388 {
1389 1389 return (xgeneric(ctx));
1390 1390 }
1391 1391
1392 1392 int
1393 1393 xfont_token(parse_context_t *ctx)
1394 1394 {
1395 1395 return (xgeneric(ctx));
1396 1396 }
1397 1397
1398 1398 int
1399 1399 xgc_token(parse_context_t *ctx)
1400 1400 {
1401 1401 return (xgeneric(ctx));
1402 1402 }
1403 1403
1404 1404 int
1405 1405 xpixmap_token(parse_context_t *ctx)
1406 1406 {
1407 1407 return (xgeneric(ctx));
1408 1408 }
1409 1409
1410 1410 int
1411 1411 xwindow_token(parse_context_t *ctx)
1412 1412 {
1413 1413 return (xgeneric(ctx));
1414 1414 }
1415 1415 /*
1416 1416 * Format of xgeneric token:
1417 1417 * XID adr_int32
1418 1418 * creator UID adr_int32
1419 1419 *
1420 1420 * Includes: xcolormap, xcursor, xfont, xgc, xpixmap, and xwindow
1421 1421 */
1422 1422 static int
1423 1423 xgeneric(parse_context_t *ctx)
1424 1424 {
1425 1425 ctx->adr.adr_now += 2 * sizeof (int32_t);
1426 1426
1427 1427 return (0);
1428 1428 }
1429 1429 /*
1430 1430 * Format of xproperty token:
1431 1431 * XID adr_int32
1432 1432 * creator UID adr_int32
1433 1433 * atom string adr_string
1434 1434 */
1435 1435 int
1436 1436 xproperty_token(parse_context_t *ctx)
1437 1437 {
1438 1438 ctx->adr.adr_now += 2 * sizeof (int32_t);
1439 1439
1440 1440 return (0);
1441 1441 }
1442 1442 /*
1443 1443 * Format of xclient token:
1444 1444 * xclient id adr_int32
1445 1445 */
1446 1446 int
1447 1447 xclient_token(parse_context_t *ctx)
1448 1448 {
1449 1449 ctx->adr.adr_now += sizeof (int32_t);
1450 1450
1451 1451 return (0);
1452 1452 }
1453 1453
1454 1454 /*
1455 1455 * -----------------------------------------------------------------------
1456 1456 * privilege_token() : Process privilege token and display contents
1457 1457 *
1458 1458 * Format of privilege token:
1459 1459 * privilege token id adr_char
1460 1460 * privilege type adr_string
1461 1461 * privilege adr_string
1462 1462 * -----------------------------------------------------------------------
1463 1463 */
↓ open down ↓ |
1463 lines elided |
↑ open up ↑ |
1464 1464
1465 1465 int
1466 1466 privilege_token(parse_context_t *ctx)
1467 1467 {
1468 1468 skip_bytes(ctx);
1469 1469 skip_bytes(ctx);
1470 1470
1471 1471 return (0);
1472 1472 }
1473 1473
1474 +/*
1475 + * -----------------------------------------------------------------------
1476 + * secflags_token() : Process secflags token and display contents
1477 + *
1478 + * Format of privilege token:
1479 + * secflags token id adr_char
1480 + * secflag set name adr_string
1481 + * secflags adr_string
1482 + * -----------------------------------------------------------------------
1483 + */
1484 +int
1485 +secflags_token(parse_context_t *ctx)
1486 +{
1487 + skip_bytes(ctx);
1488 + skip_bytes(ctx);
1489 +
1490 + return (0);
1491 +}
1474 1492
1475 1493 /*
1476 1494 * Format of label token:
1477 1495 * label ID 1 byte
1478 1496 * compartment length 1 byte
1479 1497 * classification 2 bytes
1480 1498 * compartment words <compartment length> * 4 bytes
1481 1499 */
1482 1500 int
1483 1501 label_token(parse_context_t *ctx)
1484 1502 {
1485 1503 char c;
1486 1504
1487 1505 ctx->adr.adr_now += sizeof (char); /* label ID */
1488 1506 adrm_char(&(ctx->adr), &c, 1);
1489 1507
1490 1508 ctx->adr.adr_now += sizeof (ushort_t); /* classification */
1491 1509 ctx->adr.adr_now += 4 * c; /* compartments */
1492 1510
1493 1511 return (0);
1494 1512 }
1495 1513
1496 1514 /*
1497 1515 * Format of useofpriv token:
1498 1516 * priv_type adr_char
1499 1517 * priv_set_t adr_short
1500 1518 * priv_set adr_char*(sizeof (priv_set_t))
1501 1519 */
1502 1520 int
1503 1521 useofpriv_token(parse_context_t *ctx)
1504 1522 {
1505 1523 ctx->adr.adr_now += sizeof (char); /* success / fail */
1506 1524 skip_bytes(ctx);
1507 1525
1508 1526 return (0);
1509 1527 }
↓ open down ↓ |
26 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX