1 /* NO_AUTOMATED_TESTING */
2 #include <Security/Authorization.h>
8 #define EXECUTABLE "/bin/ls"
9 #define LSTARGET "/private/var/db/shadow"
11 /* XXX/gh interactive, so inappropriate for auto-regressions */
12 int main(__unused
int ac
, const char *av
[])
14 AuthorizationRef authRef
= NULL
;
15 char *lsargs
[2] = { "-l", LSTARGET
};
16 FILE *commPipe
= NULL
;
18 char lsbuf
[6]; /* "total" */
23 /* make sure LSTARGET isn't readable by mere mortals */
24 dir
= opendir(LSTARGET
);
25 is(errno
, EACCES
, "AEWP-basic: opendir()");
26 ok_status(AuthorizationCreate(NULL
, NULL
, kAuthorizationFlagDefaults
, &authRef
),
27 "AEWP-basic: AuthCreate()");
28 ok(authRef
!= NULL
, "AEWP-basic: NULL authRef");
29 ok_status(AuthorizationExecuteWithPrivileges(authRef
,
31 kAuthorizationFlagDefaults
,
34 "AEWP-basic: AEWP()");
36 /* stops at first white space */
37 is_status(fscanf(commPipe
, "%s", lsbuf
), 1, "AEWP-basic: fscanf()");
38 printf("ls output: %s\n", lsbuf
);