/* SPDX-License-Identifier: BSD-3-Clause */
+
#include <stdio.h>
#include <unistd.h>
+
+#include "atoi/str2i.h"
#include "subid.h"
#include "stdlib.h"
#include "prototypes.h"
#include "shadowlog.h"
+
/* Test program for the subid freeing routine */
static const char Prog[] = "free_subid_range";
if (argc < 3)
usage();
range.owner = argv[0];
- range.start = atoi(argv[1]);
- range.count = atoi(argv[2]);
+ str2ul(&range.start, argv[1]);
+ str2ul(&range.count, argv[2]);
if (group)
ok = subid_ungrant_gid_range(&range);
else
/* SPDX-License-Identifier: BSD-3-Clause */
+
#include <stdio.h>
+
+#include "atoi/str2i.h"
#include "subid.h"
#include "stdlib.h"
#include "prototypes.h"
#include "shadowlog.h"
+
static const char Prog[] = "get_subid_owners";
+
static void usage(void)
{
fprintf(stderr, "Usage: [-g] %s subuid\n", Prog);
int main(int argc, char *argv[])
{
- int i, n;
- uid_t *uids;
+ int i, n;
+ long l;
+ uid_t *uids;
log_set_progname(Prog);
log_set_logfd(stderr);
if (argc < 2) {
usage();
}
- if (argc == 3 && strcmp(argv[1], "-g") == 0)
- n = subid_get_gid_owners(atoi(argv[2]), &uids);
- else if (argc == 2 && strcmp(argv[1], "-h") == 0)
+ if (argc == 3 && strcmp(argv[1], "-g") == 0) {
+ str2sl(&l, argv[2]);
+ n = subid_get_gid_owners(l, &uids);
+ } else if (argc == 2 && strcmp(argv[1], "-h") == 0) {
usage();
- else
- n = subid_get_uid_owners(atoi(argv[1]), &uids);
+ } else {
+ str2sl(&l, argv[1]);
+ n = subid_get_uid_owners(l, &uids);
+ }
if (n < 0) {
fprintf(stderr, "No owners found\n");
exit(1);
#include <stdio.h>
#include <unistd.h>
+
+#include "atoi/str2i.h"
#include "subid.h"
#include "stdlib.h"
#include "prototypes.h"
#include "shadowlog.h"
+
/* Test program for the subid creation routine */
static const char Prog[] = "new_subid_range";
range.start = 0;
range.count = 65536;
if (argc > 1)
- range.count = atoi(argv[1]);
+ str2ul(&range.count, argv[1]);
if (group)
ok = subid_grant_gid_range(&range, !makenew);
else