Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Revert "Fix logging macros in su source"

This reverts commit dfbe581.
  • Loading branch information...
commit 91d64367c5fa221ede9715c990f8bea02956714c 1 parent 6fd5133
Steve Kondik cyanogen authored

Showing 3 changed files with 21 additions and 21 deletions. Show diff stats Hide diff stats

  1. +4 4 db.c
  2. +9 9 su.c
  3. +8 8 su.h
8 db.c
@@ -28,21 +28,21 @@ int database_check(const struct su_context *ctx)
28 28 char *filename = malloc(snprintf(NULL, 0, "%s/%u-%u", REQUESTOR_STORED_PATH, ctx->from.uid, ctx->to.uid) + 1);
29 29 sprintf(filename, "%s/%u-%u", REQUESTOR_STORED_PATH, ctx->from.uid, ctx->to.uid);
30 30 if ((fp = fopen(filename, "r"))) {
31   - ALOGD("Found file");
  31 + LOGD("Found file");
32 32 char cmd[PATH_MAX];
33 33 fgets(cmd, sizeof(cmd), fp);
34 34 int last = strlen(cmd) - 1;
35   - ALOGD("this is the last character %u of the string", cmd[5]);
  35 + LOGD("this is the last character %u of the string", cmd[5]);
36 36 if (cmd[last] == '\n') {
37 37 cmd[last] = '\0';
38 38 }
39   - ALOGD("Comparing %c %s, %u to %s", cmd[last - 2], cmd, last, get_command(&ctx->to));
  39 + LOGD("Comparing %c %s, %u to %s", cmd[last - 2], cmd, last, get_command(&ctx->to));
40 40 if (strcmp(cmd, get_command(&ctx->to)) == 0) {
41 41 allow = fgetc(fp);
42 42 }
43 43 fclose(fp);
44 44 } else if ((fp = fopen(REQUESTOR_STORED_DEFAULT, "r"))) {
45   - ALOGD("Using default");
  45 + LOGD("Using default");
46 46 allow = fgetc(fp);
47 47 fclose(fp);
48 48 }
18 su.c
@@ -284,7 +284,7 @@ static void deny(const struct su_context *ctx)
284 284 char *cmd = get_command(&ctx->to);
285 285
286 286 send_intent(ctx, "", 0, ACTION_RESULT);
287   - ALOGW("request rejected (%u->%u %s)", ctx->from.uid, ctx->to.uid, cmd);
  287 + LOGW("request rejected (%u->%u %s)", ctx->from.uid, ctx->to.uid, cmd);
288 288 fprintf(stderr, "%s\n", strerror(EACCES));
289 289 exit(EXIT_FAILURE);
290 290 }
@@ -335,7 +335,7 @@ static void allow(const struct su_context *ctx)
335 335 (ctx->to.optind + (arg) < ctx->to.argc) ? " " : "", \
336 336 (ctx->to.optind + (arg) < ctx->to.argc) ? ctx->to.argv[ctx->to.optind + (arg)] : ""
337 337
338   - ALOGD("%u %s executing %u %s using shell %s : %s%s%s%s%s%s%s%s%s%s%s%s%s%s",
  338 + LOGD("%u %s executing %u %s using shell %s : %s%s%s%s%s%s%s%s%s%s%s%s%s%s",
339 339 ctx->from.uid, ctx->from.bin,
340 340 ctx->to.uid, get_command(&ctx->to), ctx->to.shell,
341 341 arg0, PARG(0), PARG(1), PARG(2), PARG(3), PARG(4), PARG(5),
@@ -437,7 +437,7 @@ int main(int argc, char *argv[])
437 437 errno = 0;
438 438 ctx.to.uid = strtoul(argv[optind], &endptr, 10);
439 439 if (errno || *endptr) {
440   - ALOGE("Unknown id: %s\n", argv[optind]);
  440 + LOGE("Unknown id: %s\n", argv[optind]);
441 441 fprintf(stderr, "Unknown id: %s\n", argv[optind]);
442 442 exit(EXIT_FAILURE);
443 443 }
@@ -483,20 +483,20 @@ int main(int argc, char *argv[])
483 483 if (strlen(cm_version) > 0) {
484 484 // only allow su on debuggable builds
485 485 if (strcmp("1", debuggable) != 0) {
486   - ALOGE("Root access is disabled on non-debug builds");
  486 + LOGE("Root access is disabled on non-debug builds");
487 487 deny(&ctx);
488 488 }
489 489
490 490 // enforce persist.sys.root_access on non-eng builds
491 491 if (strcmp("eng", build_type) != 0 &&
492 492 (atoi(enabled) & 1) != 1 ) {
493   - ALOGE("Root access is disabled by system setting - enable it under settings -> developer options");
  493 + LOGE("Root access is disabled by system setting - enable it under settings -> developer options");
494 494 deny(&ctx);
495 495 }
496 496
497 497 // disallow su in a shell if appropriate
498 498 if (ctx.from.uid == AID_SHELL && (atoi(enabled) == 1)) {
499   - ALOGE("Root access is disabled by a system setting - enable it under settings -> developer options");
  499 + LOGE("Root access is disabled by a system setting - enable it under settings -> developer options");
500 500 deny(&ctx);
501 501 }
502 502 }
@@ -511,7 +511,7 @@ int main(int argc, char *argv[])
511 511
512 512 if (st.st_gid != st.st_uid)
513 513 {
514   - ALOGE("Bad uid/gid %d/%d for Superuser Requestor application",
  514 + LOGE("Bad uid/gid %d/%d for Superuser Requestor application",
515 515 (int)st.st_uid, (int)st.st_gid);
516 516 deny(&ctx);
517 517 }
@@ -579,7 +579,7 @@ int main(int argc, char *argv[])
579 579
580 580 #define SOCKET_RESPONSE "socket:"
581 581 if (strncmp(result, SOCKET_RESPONSE, sizeof(SOCKET_RESPONSE) - 1))
582   - ALOGW("SECURITY RISK: Requestor still receives credentials in intent");
  582 + LOGW("SECURITY RISK: Requestor still receives credentials in intent");
583 583 else
584 584 result += sizeof(SOCKET_RESPONSE) - 1;
585 585
@@ -588,7 +588,7 @@ int main(int argc, char *argv[])
588 588 } else if (!strcmp(result, "ALLOW")) {
589 589 allow(&ctx);
590 590 } else {
591   - ALOGE("unknown response from Superuser Requestor: %s", result);
  591 + LOGE("unknown response from Superuser Requestor: %s", result);
592 592 deny(&ctx);
593 593 }
594 594
16 su.h
@@ -89,15 +89,15 @@ static inline char *get_command(const struct su_request *to)
89 89 }
90 90
91 91 #if 0
92   -#undef ALOGE
93   -#define ALOGE(fmt,args...) fprintf(stderr, fmt, ##args)
94   -#undef ALOGD
95   -#define ALOGD(fmt,args...) fprintf(stderr, fmt, ##args)
96   -#undef ALOGW
97   -#define ALOGW(fmt,args...) fprintf(stderr, fmt, ##args)
  92 +#undef LOGE
  93 +#define LOGE(fmt,args...) fprintf(stderr, fmt, ##args)
  94 +#undef LOGD
  95 +#define LOGD(fmt,args...) fprintf(stderr, fmt, ##args)
  96 +#undef LOGW
  97 +#define LOGW(fmt,args...) fprintf(stderr, fmt, ##args)
98 98 #endif
99 99
100   -#define PLOGE(fmt,args...) ALOGE(fmt " failed with %d: %s", ##args, errno, strerror(errno))
101   -#define PLOGEV(fmt,err,args...) ALOGE(fmt " failed with %d: %s", ##args, err, strerror(err))
  100 +#define PLOGE(fmt,args...) LOGE(fmt " failed with %d: %s", ##args, errno, strerror(errno))
  101 +#define PLOGEV(fmt,err,args...) LOGE(fmt " failed with %d: %s", ##args, err, strerror(err))
102 102
103 103 #endif

0 comments on commit 91d6436

Please sign in to comment.
Something went wrong with that request. Please try again.