/* * This function will print the policy object information to the * standard output. */ static void print_policy_params(krb5_ldap_policy_params *policyparams, int mask) { /* Print the policy DN */ printf("%25s: %s\n", "Ticket policy", policyparams->policy); /* Print max. ticket life and max. renewable life, if present */ if (mask & LDAP_POLICY_MAXTKTLIFE) printf("%25s: %s\n", "Maximum ticket life", strdur(policyparams->maxtktlife)); if (mask & LDAP_POLICY_MAXRENEWLIFE) printf("%25s: %s\n", "Maximum renewable life", strdur(policyparams->maxrenewlife)); /* Service flags are printed */ printf("%25s: ", "Ticket flags"); if (mask & LDAP_POLICY_TKTFLAGS) { int ticketflags = policyparams->tktflags; if (ticketflags & KRB5_KDB_DISALLOW_POSTDATED) printf("%s ","DISALLOW_POSTDATED"); if (ticketflags & KRB5_KDB_DISALLOW_FORWARDABLE) printf("%s ","DISALLOW_FORWARDABLE"); if (ticketflags & KRB5_KDB_DISALLOW_RENEWABLE) printf("%s ","DISALLOW_RENEWABLE"); if (ticketflags & KRB5_KDB_DISALLOW_PROXIABLE) printf("%s ","DISALLOW_PROXIABLE"); if (ticketflags & KRB5_KDB_DISALLOW_DUP_SKEY) printf("%s ","DISALLOW_DUP_SKEY"); if (ticketflags & KRB5_KDB_REQUIRES_PRE_AUTH) printf("%s ","REQUIRES_PRE_AUTH"); if (ticketflags & KRB5_KDB_REQUIRES_HW_AUTH) printf("%s ","REQUIRES_HW_AUTH"); if (ticketflags & KRB5_KDB_DISALLOW_SVR) printf("%s ","DISALLOW_SVR"); if (ticketflags & KRB5_KDB_DISALLOW_TGT_BASED) printf("%s ","DISALLOW_TGT_BASED"); if (ticketflags & KRB5_KDB_DISALLOW_ALL_TIX) printf("%s ","DISALLOW_ALL_TIX"); if (ticketflags & KRB5_KDB_REQUIRES_PWCHANGE) printf("%s ","REQUIRES_PWCHANGE"); if (ticketflags & KRB5_KDB_PWCHANGE_SERVICE) printf("%s ","PWCHANGE_SERVICE"); } printf("\n"); return; }
void module_enter(irc_t *irc, const char *channel, const char *user, const char *message) { if (!message) return; if (strstr(message, "-stats") == &message[0]) goto last; regexpr_t *regex = regexpr_create("(https?://)?(www\\.)?youtu(\\.be/|be\\.com/watch.*[?&]v=)([^&]+)", false); if (!regex) return; regexpr_match_t *matches; if (!regexpr_execute(regex, message, 5, &matches)) return; regexpr_match_t videoid = matches[4]; if (regexpr_match_invalid(videoid)) return; char *id = strdup(message); id += videoid.soff; id[videoid.eoff - videoid.soff] = '\0'; youtube_t data; if (youtube_find(id, &data)) { irc_write(irc, channel, "%s: I've seen that youtube link %d %s before, last was %s by %s on %s", user, data.count, (data.count == 1) ? "time" : "times", strdur(time(NULL) - data.timestamp), data.user, (!strcmp(data.chan, channel)) ? "this channel" : data.chan ); data.user = user; data.timestamp = time(NULL); youtube_update(id, &data); } else { data.user = user; data.count = 1; data.timestamp = time(NULL); data.chan = channel; youtube_add(id, &data); } int count; last: count = youtube_count(); irc_write(irc, channel, "%s: A total of %d %s been spammed in my presence, only %d more to go until %s waxes his nethers.", user, count, (count == 1) ? "link has" : "links have", NETHER_COUNT - count, NETHER_VICTIM ); }