Пример #1
0
iMX27RtpInterface::~iMX27RtpInterface() {
	RTP_FUNCLOG;
	CLEANUP(m_pSendWrapper);
	CLEANUP(m_pReceiveWrapper);
#ifndef MINIMAL_MODE
	if ((Configuration::GetCfg()->GetIntVal("SendPacketsFromAnxbFile") || Configuration::GetCfg()->GetIntVal("SendPacketsFromPcapFile")) && !Configuration::GetCfg()->GetIntVal("RenderVideo")) {
		return;
	}
	pMutexLock scopedLock(m_VpuMutex);

	// De-initialize VPU hardware and release data structures/resources
	vpu_UnInit();
#endif
}
Пример #2
0
SendVideoWrapper::~SendVideoWrapper() {
	if (m_pEncoder) {
		m_pEncoder->m_pVCap = NULL;
		m_pEncoder->StopEncoding();
	}
	if (m_pCapturer) {
		m_pCapturer->StopCapturing();
	}

	CLEANUP(m_pSendRtpDump);
	CLEANUP(m_pSendAnxbDump);
	CLEANUP(m_pCapturer);
	CLEANUP(m_pEncoder);
}
Пример #3
0
int main(int ac, char **av)
{
	int lc, i;
	char *msg;
	struct timespec spec;
	clockid_t clocks[2] = { CLOCK_REALTIME, CLOCK_MONOTONIC };

	if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL)
		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);

	TST_TOTAL = sizeof(clocks) / sizeof(clocks[0]);

	setup();

	for (lc = 0; TEST_LOOPING(lc); lc++) {

		Tst_count = 0;

		for (i = 0; i < TST_TOTAL; i++) {
			TEST(syscall(__NR_clock_gettime, clocks[i], &spec));
			tst_resm((TEST_RETURN < 0 ? TFAIL | TTERRNO : TPASS),
				 "%s",
				 (TEST_RETURN == 0 ? "passed" : "failed"));
		}
	}

	CLEANUP();
	tst_exit();
}
Пример #4
0
bool SkypekitTestEngine::StopPlayback() {
	TI_FUNCLOG;

	CLEANUP(m_pReceiveWrapper);

	return true;
}
Пример #5
0
/*
 * child_fn1() - Inside container
*/
static int child_fn1(void *ttype)
{
	pid_t cpid, ppid;
	cpid = getpid();
	ppid = getppid();
	char mesg[] = "I was not killed !";
       	/* Child process closes up read side of pipe */
       	close(fd[0]);

	/* Comparing the values to make sure pidns is created correctly */
	if(( cpid == CHILD_PID) && ( ppid == PARENT_PID ) ) {
		tst_resm(TINFO, "PIDNS test is running inside container");
		kill(INIT_PID, SIGKILL);
		/* Verifying whether the container init is not killed, "
		 If so writing into the pipe created in the parent NS" */

        	/* Send "mesg" through the write side of pipe */
        	write(fd[1], mesg, (strlen(mesg)+1));
	}
	else {
		tst_resm(TFAIL, "got unexpected result of cpid=%d ppid=%d",
				cpid, ppid);
	}
	CLEANUP();
	close(fd[1]);
	tst_exit();
}
Пример #6
0
void *
read_from_pngfile(char * filename,
	void *(*alloc)(int w, int h, int bpp, void** datap))
{
	struct read_file_cleanup * clup;
	void * retval;

	VERBOSE(SYSTEM, "read bitmap data from png file %s\n",
			filename);

	FILE * fp = fopen(filename, "rb");
	if (NULL == fp) {
		WARNING(SYSTEM, "open file %s for read failed\n", filename);
		THROW(EXCEPTION_RESOURCE_LOST,
				"open file for read error\n");
	}

	clup = GC_TRIVAL_CALLOC(clup);
	assert(clup != NULL);
	clup->base.function = do_read_file_cleanup;

	struct png_reader * reader = &clup->reader;
	reader->io_ptr = fp;
	reader->read_fn = file_reader;
	reader->read_ptr = NULL;
	reader->info_ptr = NULL;

	make_cleanup(&clup->base);

	retval = do_png_read(reader, alloc);
	CLEANUP(&clup->base);
	return retval;
}
Пример #7
0
void
CAudioScrobbler::Handshake()
{
	std::string username="";
	for(unsigned int i = 0; i < Config->getLUsername().length(); i++) {
		username.append(1, tolower(Config->getLUsername().c_str()[i]));
	}
	std::string authtoken(md5sum((char*)"%s%s", username.c_str(), Config->getLPassword().c_str()));

	std::ostringstream query, sig;
	query << "method=auth.getMobileSession&username="******"&authToken=" << authtoken << "&api_key=" << APIKEY;

	sig << "api_key" << APIKEY << "authToken" << authtoken << "methodauth.getMobileSessionusername" << Config->getLUsername() << SECRET;
	std::string sighash(md5sum((char*)"%s", sig.str().c_str()));

	query << "&api_sig=" << sighash;

	OpenURL(ROOTURL, query.str().c_str());

	if(_response.find("<lfm status=\"ok\">") != std::string::npos) {
		size_t start, end;
		start = _response.find("<key>") + 5;
		end = _response.find("</key>");
		_sessionid = _response.substr(start, end-start);
		iprintf("%s%s", "Last.fm handshake successful. SessionID: ", _sessionid.c_str());
		_authed = true;
	}
	else if(_response.find("<lfm status=\"failed\">") != std::string::npos) {
		CheckFailure(_response);
		exit(EXIT_FAILURE);
	}

	CLEANUP();
}
Пример #8
0
bool
CAudioScrobbler::Scrobble(centry_t* entry)
{
	bool retval = false;
	if(!_authed) {
		eprintf("Handshake hasn't been done yet.");
		Handshake();
		return retval;
	}
	iprintf("Scrobbling: %s - %s", entry->artist.c_str(), entry->title.c_str());
	
	OpenURL(ROOTURL, CreateScrobbleMessage(0, entry).c_str());
	if(_response.find("<lfm status=\"ok\">") != std::string::npos) {
		iprintf("%s", "Scrobbled successfully.");
		retval = true;
	}
	else if(_response.find("<lfm status=\"failed\">") != std::string::npos) {
		eprintf("%s%s", "Last.fm returned an error while scrobbling:\n", _response.c_str());
		if(CheckFailure(_response))
			Failure();
	}
	CLEANUP();

	return retval;
}
Пример #9
0
bool iMX27RtpInterface::StopPlayback() {
	RTP_FUNCLOG;

	CLEANUP(m_pReceiveWrapper);

	return true;
}
Пример #10
0
void cleanOptions(Options* inOptions)
/*
**  Clean up any open handles.
*/
{
    unsigned loop = 0;

    CLEANUP(inOptions->mInputName);
    CLEANUP(inOptions->mOutputName);
    if(NULL != inOptions->mOutput && stdout != inOptions->mOutput)
    {
        fclose(inOptions->mOutput);
    }

    memset(inOptions, 0, sizeof(Options));
}
Пример #11
0
 //***********************************************
 uint8_t ColYuvRgb::reset(uint32_t ww, uint32_t hh)
 {
 int flags=0;
	
    CLEANUP();
    FLAGS();
    PixelFormat fmt=TARGET_COLORSPACE;
    if(_inverted) fmt=ALTERNATE_COLORSPACE;
    if(!ww || !hh) return 0;

	if (_context)
		sws_freeContext((SwsContext *)_context);

	/* 
	FIXME: remove when ffmpeg is fixed
	Without SWS_ACCURATE_RND the quality is bad 
	for YUV->RGB (caused by libswscale r28700) 
	*/
	flags |= SWS_ACCURATE_RND;

	 _context=(void *)sws_getContext(
                      ww,hh,
                      PIX_FMT_YUV420P ,
                      ww,hh,
                      fmt,
                      flags, NULL, NULL,NULL);

    if(!_context) ADM_assert(0);
    w=ww;
    h=hh;
    return 1;
}
Пример #12
0
DWORD WINAPI   CardDeleteContext
               (
                  __inout PCARD_DATA  pCardData
               )
{
   DWORD             dwReturn    = 0;

   LogTrace(LOGTYPE_INFO, WHERE, "Enter API...");

   /********************/
   /* Check Parameters */
   /********************/
   if ( pCardData == NULL )
   {
      LogTrace(LOGTYPE_ERROR, WHERE, "Invalid parameter [pCardData]");
      CLEANUP(SCARD_E_INVALID_PARAMETER);
   }

   LogTrace(LOGTYPE_INFO, WHERE, "Context:[0x%08X]", pCardData->hSCardCtx);
   if (pCardData->pvVendorSpecific != NULL)
   {
	   pCardData->pfnCspFree(pCardData->pvVendorSpecific);
	   pCardData->pvVendorSpecific = NULL;
   }
	
cleanup:

   LogTrace(LOGTYPE_INFO, WHERE, "Exit API...");

   return (dwReturn);
}
Пример #13
0
int main(int argc, char *argv[])
{
	int status;
	pid_t pid;

	setup();

	pid = getpid();

	/* Container creation on PID namespace */
	TEST(do_clone_unshare_test(T_CLONE, CLONE_NEWPID, child_fn, NULL));
	if (TEST_RETURN == -1) {
		tst_brkm(TBROK | TTERRNO, CLEANUP, "clone failed");
	}

	sleep(1);
	if (wait(&status) < 0)
		tst_resm(TWARN, "parent: waitpid() failed.");

	if (WIFEXITED(status) && WEXITSTATUS(status) != 0)
		tst_resm(TBROK, "container was terminated abnormally");

	CLEANUP();
	tst_exit();
}
Пример #14
0
CK_RV C_GetMechanismInfo(CK_SLOT_ID slotID,
	CK_MECHANISM_TYPE type,
	CK_MECHANISM_INFO_PTR pInfo)
{
	CK_RV ret;
	log_trace(WHERE, "I: enter");

	if (p11_get_init() != BEIDP11_INITIALIZED)
	{
		log_trace(WHERE, "I: leave, CKR_CRYPTOKI_NOT_INITIALIZED");
		return (CKR_CRYPTOKI_NOT_INITIALIZED);
	}		

	ret = p11_lock();
	if (ret != CKR_OK)
	{
		log_trace(WHERE, "I: leave, p11_lock failed with %i",ret);
		return ret;
	}

	log_trace(WHERE, "S: C_GetMechanismInfo(slot %d)", slotID);

	if (pInfo == NULL_PTR)
	{
		CLEANUP(CKR_ARGUMENTS_BAD);
	}

	/*ret = cal_get_mechanism_info(slotID, type, pInfo);
	if (ret != CKR_OK)
	{
		log_trace(WHERE, "E: p11_get_mechanism_info(slotid=%d) returns %d", slotID, ret);
		goto cleanup;
	}*/
    if (g_aseP11Handle == NULL)
    {
        log_trace(WHERE, "E: leave, CKR_CRYPTOKI_NOT_INITIALIZED - g_aseP11Handle is NULL");
        CLEANUP(CKR_ARGUMENTS_BAD);
    }

    ret = (pFunctions->C_GetMechanismInfo) ( slotID,  type, pInfo);


cleanup:        
	p11_unlock();
	log_trace(WHERE, "I: leave, ret = %i",ret);
	return ret;
}
Пример #15
0
DWORD WINAPI   CardQueryKeySizes
               (
                  __in      PCARD_DATA       pCardData,
                  __in      DWORD            dwKeySpec,
                  __in      DWORD            dwFlags,
                  __in      PCARD_KEY_SIZES  pKeySizes
               )
{
   DWORD             dwReturn = 0;

   LogTrace(LOGTYPE_INFO, WHERE, "Enter API...");

   /********************/
   /* Check Parameters */
   /********************/
   if ( pCardData == NULL )
   {
      LogTrace(LOGTYPE_ERROR, WHERE, "Invalid parameter [pCardData]");
      CLEANUP(SCARD_E_INVALID_PARAMETER);
   }
   if ( dwKeySpec != AT_SIGNATURE )
   {
      LogTrace(LOGTYPE_ERROR, WHERE, "Invalid parameter [dwKeySpec]");
      CLEANUP(SCARD_E_INVALID_PARAMETER);
   }
   if ( dwFlags != 0 )
   {
      LogTrace(LOGTYPE_ERROR, WHERE, "Invalid parameter [dwKeySpec]");
      CLEANUP(SCARD_E_INVALID_PARAMETER);
   }
   if ( pKeySizes == NULL )
   {
      LogTrace(LOGTYPE_ERROR, WHERE, "Invalid parameter [pKeySizes]");
      CLEANUP(SCARD_E_INVALID_PARAMETER);
   }

   pKeySizes->dwVersion           = CARD_KEY_SIZES_CURRENT_VERSION;
   pKeySizes->dwMinimumBitlen     = 1024;
   pKeySizes->dwDefaultBitlen     = 1024;
   pKeySizes->dwMaximumBitlen     = 1024;
   pKeySizes->dwIncrementalBitlen = 0;

cleanup:
   LogTrace(LOGTYPE_INFO, WHERE, "Exit API...");
   return(dwReturn);
}
Пример #16
0
int main(int argc, char *argv[])
{
	int ret, status, nbytes;
        char    readbuffer[80];

	pipe(fd);
	ret = do_clone_unshare_test(T_CLONE, CLONE_NEWPID, child_fn1, NULL);
	if ((wait(&status)) < 0) {
		tst_resm(TWARN, "wait() failed, skipping this test case");
		/* Cleanup & continue with next test case */
		CLEANUP();
	}
	if (ret == -1) {
		tst_resm(TFAIL, "clone() Failed, errno = %d :"
			" %s", ret, strerror(ret));
		/* Cleanup & continue with next test case */
		CLEANUP();
	}

	/* Parent process closes up write side of pipe */
	close(fd[1]);
	/* Read in a string from the pipe */
	nbytes = read(fd[0], readbuffer, sizeof(readbuffer));

	if (nbytes !=0 ) {
		tst_resm(TPASS, "Container init : %s", readbuffer);
	}
	else {
		tst_resm(TFAIL, "Container init is killed by SIGKILL !!!");
	}

	if (WTERMSIG(status)) {
		tst_resm(TFAIL, "Container init pid got killed by signal %d",
		WTERMSIG(status));
	}
        /* cleanup and exit */
	CLEANUP();
	close(fd[0]);

	tst_exit();

}	/* End main */
Пример #17
0
DWORD WINAPI   CardQueryCapabilities
(
    __in      PCARD_DATA          pCardData,
    __in      PCARD_CAPABILITIES  pCardCapabilities
)
{
   DWORD    dwReturn  = 0;
   DWORD    dwVersion = 0;

   LogTrace(LOGTYPE_INFO, WHERE, "Enter API...");

   /********************/
   /* Check Parameters */
   /********************/
   if ( pCardData == NULL )
   {
      LogTrace(LOGTYPE_ERROR, WHERE, "Invalid parameter [pCardData]");
      CLEANUP(SCARD_E_INVALID_PARAMETER);
   }
   if ( pCardCapabilities == NULL )
   {
      LogTrace(LOGTYPE_ERROR, WHERE, "Invalid parameter [pCardCapabilities]");
      CLEANUP(SCARD_E_INVALID_PARAMETER);
   }
   dwVersion = (pCardCapabilities->dwVersion == 0) ? 1 : pCardCapabilities->dwVersion;
   if ( dwVersion != CARD_CAPABILITIES_CURRENT_VERSION )
   {
      LogTrace(LOGTYPE_ERROR, WHERE, "Invalid parameter [pCardCapabilities->dwVersion]");
      CLEANUP(ERROR_REVISION_MISMATCH );
   }

   /* It's the Base CSP/CNG KSP performs these operations if the card minidriver cannot do so */
   //pCardCapabilities->dwVersion                = CARD_CAPABILITIES_CURRENT_VERSION;
   pCardCapabilities->fCertificateCompression  = TRUE;
   pCardCapabilities->fKeyGen                  = FALSE;

cleanup:
   LogTrace(LOGTYPE_INFO, WHERE, "Exit API...");
   return(dwReturn);
}
Пример #18
0
DWORD WINAPI   CardDeleteDirectory
               (
                  __in    PCARD_DATA  pCardData,
                  __in    LPSTR       pszDirectoryName
               )
{
   DWORD    dwReturn = 0;
   LogTrace(LOGTYPE_INFO, WHERE, "Enter API...");

   CLEANUP(SCARD_E_UNSUPPORTED_FEATURE);

cleanup:
   LogTrace(LOGTYPE_INFO, WHERE, "Exit API...");
   return(dwReturn);
}
Пример #19
0
DWORD WINAPI   CardRSADecrypt
               (
                  __in        PCARD_DATA              pCardData,
                  __inout     PCARD_RSA_DECRYPT_INFO  pInfo
               )
{
   DWORD    dwReturn = 0;
   LogTrace(LOGTYPE_INFO, WHERE, "Enter API...");

   CLEANUP(SCARD_E_UNSUPPORTED_FEATURE);

cleanup:
   LogTrace(LOGTYPE_INFO, WHERE, "Exit API...");
   return(dwReturn);
}
Пример #20
0
XF86ConfModesPtr
xf86parseModesSection (void)
{
	int has_ident = FALSE;
	int token;
	parsePrologue (XF86ConfModesPtr, XF86ConfModesRec)

	while ((token = xf86getToken (ModesTab)) != ENDSECTION)
	{
		switch (token)
		{
		case COMMENT:
			ptr->modes_comment = xf86addComment(ptr->modes_comment, val.str);
			break;
		case IDENTIFIER:
			if (xf86getSubToken (&(ptr->modes_comment)) != STRING)
				Error (QUOTE_MSG, "Identifier");
			if (has_ident == TRUE)
				Error (MULTIPLE_MSG, "Identifier");
			ptr->modes_identifier = xf86configStrdup(val.str);
			has_ident = TRUE;
			break;
		case MODE:
			HANDLE_LIST (mon_modeline_lst, xf86parseVerboseMode,
						 XF86ConfModeLinePtr);
			break;
		case MODELINE:
			HANDLE_LIST (mon_modeline_lst, xf86parseModeLine,
						 XF86ConfModeLinePtr);
			break;
		case OPTION:
			ptr->modes_option_lst = xf86parseOption(ptr->modes_option_lst);
			break;
		default:
			xf86parseError (INVALID_KEYWORD_MSG, xf86tokenString ());
			CLEANUP (ptr);
			return NULL;
		}
	}

	if (!has_ident)
		Error (NO_IDENT_MSG, NULL);

#ifdef DEBUG
	printf ("Modes section parsed\n");
#endif
	return ptr;
}
Пример #21
0
DWORD WINAPI   CardCreateDirectory
               (
                  __in    PCARD_DATA                        pCardData,
                  __in    LPSTR                             pszDirectoryName,
                  __in    CARD_DIRECTORY_ACCESS_CONDITION   AccessCondition
               )
{
   DWORD    dwReturn = 0;
   LogTrace(LOGTYPE_INFO, WHERE, "Enter API...");

   CLEANUP(SCARD_E_UNSUPPORTED_FEATURE);

cleanup:
   LogTrace(LOGTYPE_INFO, WHERE, "Exit API...");
   return(dwReturn);
}
Пример #22
0
bool iMX27RtpInterface::StopRecording() {
	RTP_FUNCLOG;

	m_RecordingStarted = false;
	CLEANUP(m_pSendWrapper);

	if (Configuration::GetCfg()->GetIntVal("TogglePayloadFormat")) {
		// to ensure both payload formats get tested we switch between FRAMES and RTP - this is for testing purposes only
		if (m_PayloadFormat == FORMAT_FRAMES) {
			m_PayloadFormat = FORMAT_RTP;
		} else {
			m_PayloadFormat = FORMAT_FRAMES;
		}
	}

	return true;
}
Пример #23
0
XF86ConfigPtr
xf86readConfigFile()
{
	XF86ConfigPtr ptr;

	ptr = xf86parseConfigFile(NULL);
	if (!ptr)
		return NULL;

	if (xf86validateConfig(ptr))
		return ptr;
	else
	{
		CLEANUP(ptr);
		return NULL;
	}
}
Пример #24
0
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
uint8_t ColYv12Rgb24::reset(uint32_t ww, uint32_t hh)
 {
 int flags=0;
	CLEANUP();
    FLAGS();
   
	 _context=(void *)sws_getContext(
				    		ww,hh,
						PIX_FMT_YUV420P ,
		 				ww,hh,
	   					PIX_FMT_RGB24,
	    					flags, NULL, NULL,NULL);

    if(!_context) ADM_assert(0);
    w=ww;
    h=hh;
    return 1;
}
Пример #25
0
bool
CAudioScrobbler::SendNowPlaying(mpd_Song* song)
{
	bool retval = false;
	if(!song || !song->artist || !song->title) return retval;

	char* artist = curl_easy_escape(_handle, song->artist, 0);
	char* title = curl_easy_escape(_handle, song->title, 0);
	char* album = 0;
	if(song->album)
		album = curl_easy_escape(_handle, song->album, 0);

	std::ostringstream query, sig;
	query << "method=track.updateNowPlaying&track=" << title << "&artist=" << artist << "&duration=" << song->time << "&api_key=" << APIKEY << "&sk=" << _sessionid;
	if(album) {
		query << "&album=" << album;
		sig << "album" << song->album;
	}

    curl_free(artist);
    curl_free(title);
    curl_free(album);

	sig << "api_key" << APIKEY << "artist" << song->artist << "duration" << song->time << "methodtrack.updateNowPlaying" << "sk" << _sessionid << "track" << song->title << SECRET;

	std::string sighash(md5sum((char*)"%s", sig.str().c_str()));

	query << "&api_sig=" << sighash;

	OpenURL(ROOTURL, query.str().c_str());

	if(_response.find("<lfm status=\"ok\">") != std::string::npos) {
		iprintf("%s", "Updated \"Now Playing\" status successfully.");
		retval = true;
	}
	else if(_response.find("<lfm status=\"failed\">") != std::string::npos) {
		eprintf("%s%s", "Last.fm returned an error while updating the currently playing track:\n", _response.c_str());
		if(CheckFailure(_response))
			Failure();
	}

	CLEANUP();
	return retval;
}
Пример #26
0
 //***********************************************
 uint8_t ColYuvRgb::reset(uint32_t ww, uint32_t hh)
 {
 int flags=0;
	
    CLEANUP();
    FLAGS();
    
	 _context=(void *)sws_getContext(
				    		ww,hh,
						PIX_FMT_YUV420P ,
		 				ww,hh,
                                                TARGET_COLORSPACE,
	    					flags, NULL, NULL,NULL);

    if(!_context) ADM_assert(0);
    w=ww;
    h=hh;
    return 1;
}
Пример #27
0
CK_RV C_GetMechanismList(CK_SLOT_ID slotID,
	CK_MECHANISM_TYPE_PTR pMechanismList,
	CK_ULONG_PTR pulCount)
{
	CK_RV ret;
	log_trace(WHERE, "I: enter");

	if (p11_get_init() != BEIDP11_INITIALIZED)
	{
		log_trace(WHERE, "I: leave, CKR_CRYPTOKI_NOT_INITIALIZED");
		return (CKR_CRYPTOKI_NOT_INITIALIZED);
	}		

	ret = p11_lock();
	if (ret != CKR_OK)
	{
		log_trace(WHERE, "I: leave, p11_lock failed with %i",ret);
		return ret;
	}

	log_trace(WHERE, "S: C_GetMechanismList(slot %d)", slotID);

	/*ret = cal_get_mechanism_list(slotID, pMechanismList,pulCount);
	if (ret != CKR_OK)
	{
		log_trace(WHERE, "E: cal_get_mechanism_list(slotid=%d) returns %s", slotID, log_map_error(ret));
		goto cleanup;
	}*/
    if (g_aseP11Handle == NULL)
    {
        log_trace(WHERE, "E: leave, CKR_CRYPTOKI_NOT_INITIALIZED - g_aseP11Handle is NULL");
        CLEANUP(CKR_ARGUMENTS_BAD);
    }

    ret = (pFunctions->C_GetMechanismList) ( slotID,  pMechanismList, pulCount);


cleanup:

	p11_unlock();
	log_trace(WHERE, "I: leave, ret = %i",ret);
	return ret;
}
Пример #28
0
DWORD WINAPI CardDeriveKey
(
    __in    PCARD_DATA        pCardData,
    __in    PCARD_DERIVE_KEY  pAgreementInfo
)
{
   DWORD    dwReturn = 0;
   LogTrace(LOGTYPE_INFO, WHERE, "Enter API...");

   /* 
    * For RSA-only card minidrivers, this entry point is not defined and is
    * set to NULL in the CARD_DATA structure returned from CardAcquireContext
    */
   CLEANUP(SCARD_E_UNSUPPORTED_FEATURE);

cleanup:
   LogTrace(LOGTYPE_INFO, WHERE, "Exit API...");
   return(dwReturn);
}
Пример #29
0
static int cmdlet_check(CmdLetData *cdata, int ac, char **av)
{
    int i = 0, matches = 0;
    int status = STATUS_OK; /* let's be optimisc, once in lifetime */

    if (ac < 2) {
        tc_log_error(EXE, "not enough arguments for `check' mode");
        return STATUS_BAD_PARAM;
    }

    for (i = 0; i < ac; i++) {
        modrequest_load(cdata->factory, &cdata->mods[cdata->modsnum], av[i]);
        cdata->modsnum++;
    }

    status = STATUS_OK;
    if (cdata->modsnum >= 2) {
        /* N modules, so N - 1 interfaces */
        for (i = 0; i < cdata->modsnum - 1; i++) {
            int ret = check_module_pair(&cdata->mods[i], &cdata->mods[i + 1],
                                        &cdata->mods[i],
                                        (verbose >= TC_INFO) ?TC_DEBUG :TC_QUIET);
            if (ret != -1) { /* no error */
                matches += ret;
            }
                
        }
        if (matches < cdata->modsnum - 1) {
            status = STATUS_MODULE_MISMATCH;
        }
    }

    if (verbose) {
        if (status == STATUS_OK) {
            tc_log_info(EXE, "module chain OK");
        } else {
            tc_log_info(EXE, "module chain ILLEGAL");
        }
    }

    CLEANUP(cdata);
    return status;
}
Пример #30
0
int
main (int argc, char **argv)
{
    char *s, *pass = 0;
    int i;

    INIT ();
    while ((i = getopt (argc, argv, "c:vh")) != -1)
    {
	switch (i)
	{
	case 'c':
	    pass = optarg;
	    break;
	default:
	    usage ();
	}
    }

    if (!argv[optind])
	usage ();

    if (pass)
    {
	if (check_pass (pass, argv[optind]))
	    puts ("invalid password");
	else
	    puts ("OK");
    }
    else
    {
	Current_Time = time (0);
	init_random ();
	s = generate_pass (argv[optind]);
	puts (s);
	if (check_pass (s, argv[optind]))
	    puts ("error");
	FREE (s);
	CLEANUP ();
    }
    exit (0);
}