static char *get_pg_args(void) { char buf[256]; int *aptr; int i; int j; j = 0; buf[j++] = hexlist[get_enable() & 0x0f]; buf[j++] = hexlist[get_advertise() & 0x0f]; buf[j++] = hexlist[get_willing() & 0x0f]; if (get_fargs()) { aptr = get_up2tc(); for (i=0; i<MAX_USER_PRIORITIES; i++) if (aptr[i] >= 0) buf[j++] = hexlist[aptr[i] & 0x0f]; else buf[j++] = CLIF_NOT_SUPPLIED; aptr = get_pgpct(); for (i=0; i<MAX_BANDWIDTH_GROUPS; i++) { if (aptr[i] >= 0) { buf[j++] = hexlist[(aptr[i] & 0xf0)>>4]; buf[j++] = hexlist[aptr[i] & 0x0f]; } else { buf[j++] = CLIF_NOT_SUPPLIED; buf[j++] = CLIF_NOT_SUPPLIED; } }
/* * This function interprets the reply and prints it to stdout. It returns * 0 if no more should be read and 1 to indicate that more messages of this * type may need to be read. */ int audit_print_reply(struct audit_reply *rep, int fd) { _audit_elf = 0; switch (rep->type) { case NLMSG_NOOP: return 1; case NLMSG_DONE: // Close the socket so kernel can do other things audit_close(fd); if (printed == 0) printf("No rules\n"); else { lnode *n; list_first(&l); n = l.cur; while (n) { print_rule(n->r); n = list_next(&l); } list_clear(&l); } break; case NLMSG_ERROR: printf("NLMSG_ERROR %d (%s)\n", -rep->error->error, strerror(-rep->error->error)); printed = 1; break; case AUDIT_GET: if (interpret) printf("enabled %s\nfailure %s\n", get_enable(rep->status->enabled), get_failure(rep->status->failure)); else printf("enabled %u\nfailure %u\n", rep->status->enabled, rep->status->failure); printf("pid %u\nrate_limit %u\nbacklog_limit %u\n" "lost %u\nbacklog %u\n", rep->status->pid, rep->status->rate_limit, rep->status->backlog_limit, rep->status->lost, rep->status->backlog); #if HAVE_DECL_AUDIT_VERSION_BACKLOG_WAIT_TIME printf("backlog_wait_time %u\n", rep->status->backlog_wait_time); #endif printed = 1; break; #if HAVE_DECL_AUDIT_FEATURE_VERSION case AUDIT_GET_FEATURE: { uint32_t mask = AUDIT_FEATURE_TO_MASK(AUDIT_FEATURE_LOGINUID_IMMUTABLE); if (rep->features->mask & mask) printf("loginuid_immutable %u %s\n", !!(rep->features->features & mask), rep->features->lock & mask ? "locked" : "unlocked"); } printed = 1; break; #endif case AUDIT_LIST_RULES: list_requested = 0; if (key_match(rep->ruledata)) list_append(&l, rep->ruledata, sizeof(struct audit_rule_data) + rep->ruledata->buflen); printed = 1; return 1; default: printf("Unknown: type=%d, len=%d\n", rep->type, rep->nlh->nlmsg_len); printed = 1; break; } return 0; }
static jboolean door_isOpen(JNIEnv *env, jobject object) { return get_enable() == 0; }