- char realm[REALM_SZ + 1];
- static int inited = 0;
- int success = 0, tries = 0, fd, cc;
- CREDENTIALS *c, *get_ticket();
- struct passwd *pw;
- char buf[128], localcell[128], *p, *index();
-
- while (success == 0 && tries < 3) {
- if (!inited) {
- if (krb_get_lrealm(realm) != KSUCCESS)
- (void) strcpy(realm, KRB_REALM);
- sprintf(buf, "/tmp/tkt_%d_afsinc", getpid());
- krb_set_tkt_string(buf);
-
- if ((fd = open("/usr/vice/etc/ThisCell", O_RDONLY, 0)) < 0) {
- critical_alert("incremental", "unable to find AFS cell");
- unlog();
- exit(1);
- }
- if ((cc = read(fd, localcell, sizeof(localcell))) < 0) {
- critical_alert("incremental", "unable to read AFS cell");
- unlog();
- exit(1);
- }
- close(fd);
- p = index(localcell, '\n');
- if (p) *p = 0;
-
- if (((pw = getpwnam("smsdba")) == NULL) ||
- ((c = get_ticket("sms", "", realm, localcell)) == NULL) ||
- (setpag() < 0) ||
- (setreuid(pw->pw_uid, pw->pw_uid) < 0) ||
- aklog(c, localcell)) {
- com_err(whoami, 0, "failed to authenticate");
- } else
- inited++;
- }
-
- if (inited) {
- com_err(whoami, 0, "Executing command: %s", cmd);
- if (system(cmd) == 0)
- success++;
- }
- if (!success) {
- tries++;
- sleep(5 * 60);
- }
+ int success = 0, tries = 0;
+
+ while (success == 0 && tries < 1) {
+ if (tries++)
+ sleep(5*60);
+ com_err(whoami, 0, "Executing command: %s", cmd);
+ if (system(cmd) == 0)
+ success++;