X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=extensions%2Flibip6t_owner.c;h=99b5c1346c62105866a03819569059dca41a00b5;hb=6afea0b41dfbc3824956d11d960ad80097218feb;hp=ed785306706e8afec224ee62c14f7ed1b1bd9fc0;hpb=f7b70cf9e00324b89b02de213bcd0dde7044d035;p=iptables.git diff --git a/extensions/libip6t_owner.c b/extensions/libip6t_owner.c index ed78530..99b5c13 100644 --- a/extensions/libip6t_owner.c +++ b/extensions/libip6t_owner.c @@ -47,14 +47,6 @@ static struct option opts[] = { {0} }; -/* Initialize the match. */ -static void -init(struct ip6t_entry_match *m, unsigned int *nfcache) -{ - /* Can't cache this. */ - *nfcache |= NFC_UNKNOWN; -} - /* Function which parses command options; returns true if it ate an option */ static int @@ -129,6 +121,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, exit_error(PARAMETER_PROBLEM, "OWNER CMD `%s' too long, max %d characters", optarg, sizeof(ownerinfo->comm)); strncpy(ownerinfo->comm, optarg, sizeof(ownerinfo->comm)); + ownerinfo->comm[sizeof(ownerinfo->comm)-1] = '\0'; if (invert) ownerinfo->invert |= IP6T_OWNER_COMM; @@ -148,11 +141,11 @@ print_item(struct ip6t_owner_info *info, u_int8_t flag, int numeric, char *label { if(info->match & flag) { - printf(label); - if (info->invert & flag) printf("! "); + printf(label); + switch(info->match & flag) { case IP6T_OWNER_UID: if(!numeric) { @@ -236,20 +229,17 @@ save(const struct ip6t_ip6 *ip, const struct ip6t_entry_match *match) #endif } -static -struct ip6tables_match owner -= { NULL, - "owner", - IPTABLES_VERSION, - IP6T_ALIGN(sizeof(struct ip6t_owner_info)), - IP6T_ALIGN(sizeof(struct ip6t_owner_info)), - &help, - &init, - &parse, - &final_check, - &print, - &save, - opts +static struct ip6tables_match owner = { + .name = "owner", + .version = IPTABLES_VERSION, + .size = IP6T_ALIGN(sizeof(struct ip6t_owner_info)), + .userspacesize = IP6T_ALIGN(sizeof(struct ip6t_owner_info)), + .help = &help, + .parse = &parse, + .final_check = &final_check, + .print = &print, + .save = &save, + .extra_opts = opts, }; void _init(void)