ECode AbstractEventLogger::OnCompleted( /* [in] */ Int32 statusCode) { if (mLogWritten) { return NOERROR; } else { mLogWritten = TRUE; } Int64 UNUSED(completionTime) = SystemClock::GetElapsedRealtime(); // We don't report latency for stopped syntheses because their overall // total time spent will be inaccurate (will not correlate with // the length of the utterance). // onAudioDataWritten() should normally always be called, and hence mPlaybackStartTime // should be set, if an error does not occur. if (statusCode != ITextToSpeech::TTS_SUCCESS || mPlaybackStartTime == -1 || mEngineCompleteTime == -1) { LogFailure(statusCode); return NOERROR; } Int64 audioLatency = mPlaybackStartTime - mReceivedTime; Int64 engineLatency = mEngineStartTime - mRequestProcessingStartTime; Int64 engineTotal = mEngineCompleteTime - mRequestProcessingStartTime; LogSuccess(audioLatency, engineLatency, engineTotal); return NOERROR; }
/* ARGSUSED */ void OkCallback( Widget w, XtPointer clientData, XtPointer callData ) { Boolean valid = False; /* Do any verification here */ /* check for primary passwd... */ if (!strcmp (crypt (password, toPword), toPword)) valid = True; /* check for secondary passwd ... */ if (rootPword && *rootPword && !strcmp (crypt (password, rootPword), rootPword)) { valid = True; } else if (((rootPword == NULL) || (*rootPword == '\0')) && (*password == '\0')) { /* No root password, and the user entered no password */ valid = True; } /* If valid password, then unpost */ if (valid) { XtUnmanageChild(dlog); XFlush(XtDisplay(dlog)); finished = True; LogSuccess(); } else { /* Invalid password */ Widget err; int n; Arg args[10]; XmString okLabel; XmString message; char * template; char * title; char * master; okLabel = XmStringCreateLocalized(GETMESSAGE(1, 2, "OK"));
void CheckUserRequest( void ) { unsigned short ruid; unsigned short rgid; struct passwd * passwd; #ifdef sun struct spwd * spwd; #endif Boolean notExist = False; Boolean alreadySetToRoot = False; rootRequest = False; /* get current group id */ rgid = getgid(); /* get current user id */ ruid = getuid(); /* See if the user wants to run as himself */ if (appArgs.user == NULL) { SetGidUid(rgid,ruid); return; } /* Get password for the requested user */ passwd = getpwnam(appArgs.user); if (passwd) { #ifdef sun spwd = getspnam(appArgs.user); if (spwd) { #endif if (passwd->pw_uid == ruid) { /* * We are already running as the * requested user. So return now. */ SetGidUid(rgid,ruid); return; } #ifdef sun if (spwd->sp_pwdp) toPword = XtNewString(spwd->sp_pwdp); } #else if (passwd->pw_passwd) toPword = XtNewString(passwd->pw_passwd); #endif /* sun */ basegid = passwd->pw_gid; newuid = passwd->pw_uid; } else notExist = True; /* Root requests require some extra work later */ if (strcmp(appArgs.user, "root") == 0) rootRequest = True; /* Get name for the current user */ passwd = getpwuid(ruid); if (passwd && passwd->pw_name) origName = XtNewString(passwd->pw_name); /* Get password for the root user */ passwd = getpwnam("root"); if (passwd && passwd->pw_passwd) { #ifdef sun spwd = getspnam("root"); if (spwd && spwd->sp_pwdp) { rootPword = XtNewString(spwd->sp_pwdp); } #else rootPword = XtNewString(passwd->pw_passwd); #endif /* sun */ if (passwd->pw_uid == ruid) alreadySetToRoot = True; } /* * If 'alreadySetToRoot' is set to True, then that means that the * user is currently running as root. */ if (notExist) { /* Requested user does not exist; this function will exit() */ UnknownUser(); } else if ((alreadySetToRoot) || /* requested users passwd is null */ ((toPword && (toPword[0] == '\0')) || (toPword == NULL))) { /* Already there -- no need to check a passwd */ LogSuccess(); } else CheckPasswd(); }