#include <mLib/report.h>
#include "checkpath.h"
+#include "utils.h"
/*----- Static variables --------------------------------------------------*/
fp);
}
-/* --- @allowgroup@ --- *
- *
- * Arguments: @const char *gname@ = trust group @gname@
- *
- * Returns: ---
- *
- * Use: Adds the gid corresponding to @gname@ (which may be a number)
- * to the list of things we trust.
- */
-
-static void allowgroup(const char *gname)
-{
- struct group *gr;
- const char *p;
- gid_t g;
-
- /* --- Check for numeric group spec --- */
-
- for (p = gname; *p; p++) {
- if (!isdigit((unsigned char)*p))
- goto lookup;
- }
- g = atoi(gname);
- goto insert;
-
- /* --- Look up a group by name --- */
-
-lookup:
- if ((gr = getgrnam(gname)) == 0)
- die(1, "group %s not found", gname);
- g = gr->gr_gid;
-
- /* --- Insert the group into the table --- */
-
-insert:
- if (cp.cp_gids >= N(cp.cp_gid))
- die(1, "too many groups");
- cp.cp_gid[cp.cp_gids++] = g;
-}
-
/* --- @main@ --- *
*
* Arguments: @int argc@ = number of command line arguments
return (!fullcheck(optarg));
break;
case 'g':
- allowgroup(optarg);
+ allowgroup(&cp, optarg);
break;
case 'v':
cp.cp_verbose++;