Author: kkaempf Date: Fri Oct 19 19:31:05 2007 New Revision: 7575 URL: http://svn.opensuse.org/viewcvs/zypp?rev=7575&view=rev Log: - catch 'hardwareInfo' (noop) - catch 'keep' (noop) - use MAXNAMELEN instead of constant 100 checking buffer overflows is still pending Modified: trunk/sat-solver/testsuite/deptestomatic.c Modified: trunk/sat-solver/testsuite/deptestomatic.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/testsuite/deptestomatic.c?rev=7575&r1=7574&r2=7575&view=diff ============================================================================== --- trunk/sat-solver/testsuite/deptestomatic.c (original) +++ trunk/sat-solver/testsuite/deptestomatic.c Fri Oct 19 19:31:05 2007 @@ -27,6 +27,7 @@ static const char *Current; +#define MAXNAMELEN 100 static void err( const char *msg, ...) @@ -53,6 +54,7 @@ STATE_FORCEINSTALL, STATE_FORCEUNINSTALL, STATE_LOCK, + STATE_KEEP, STATE_MEDIAID, STATE_MEDIAORDER, STATE_TRIAL, @@ -123,6 +125,8 @@ { STATE_TRIAL, "mediaorder", STATE_MEDIAORDER, 0 }, { STATE_TRIAL, "instorder", STATE_INSTORDER, 0 }, { STATE_TRIAL, "availablelocales",STATE_AVAILABLELOCALES, 0 }, + { STATE_TRIAL, "keep", STATE_KEEP, 0 }, + { NUMSTATES } }; @@ -480,7 +484,7 @@ return ID_NULL; } -static void getPackageName( const char **atts, char package[100] ) +static void getPackageName( const char **atts, char package[] ) { package[0] = 0; const char *packattr = attrval( atts, "package" ); @@ -492,12 +496,12 @@ /* for non-packages we prepend the namespace */ if (kind != NULL && strcmp(kind, "package") ) { - strncpy(package, kind, 100); - strncat(package, ":" , 100); + strncpy(package, kind, MAXNAMELEN); + strncat(package, ":" , MAXNAMELEN); } if (packattr) - strncat(package, packattr, 100); + strncat(package, packattr, MAXNAMELEN); } @@ -518,9 +522,9 @@ cmap->source = pd->locales; } - char locale[100]; + char locale[MAXNAMELEN]; strcpy(locale, "language:"); - strncat(locale, name, 100); + strncat(locale, name, MAXNAMELEN); Solvable s; memset(&s, 0, sizeof(Solvable)); @@ -533,8 +537,8 @@ Id pr = source_addid_dep(pd->locales, 0, str2id(pd->pool, locale, 1), 0); strcpy(locale, "Locale("); - strncat(locale, name, 100); - strncat(locale, ")", 100); + strncat(locale, name, MAXNAMELEN); + strncat(locale, ")", MAXNAMELEN); pr = source_addid_dep(pd->locales, pr, str2id(pd->pool, locale, 1), 0); s.provides = pd->locales->idarraydata + pr; @@ -715,7 +719,7 @@ const char *sep1 = strchr(name, '@'); const char *sep2 = strchr(name, '.'); - char locale[100]; + char locale[MAXNAMELEN]; if (!sep1 && !sep2) { strncpy(locale, name, sizeof(locale)); @@ -824,6 +828,9 @@ case STATE_MEDIAID: /* output installation order with media id */ break; + case STATE_HARDWAREINFO: + break; + /*-----------------------------------------------------------*/ /* <trial> stuff */ @@ -839,7 +846,7 @@ const char *channel = attrval( atts, "channel" ); const char *arch = attrval( atts, "arch" ); - char package[100]; + char package[MAXNAMELEN]; getPackageName( atts, package ); if (!strlen(package)) @@ -883,7 +890,7 @@ break; case STATE_REMOVE: { /* remove package */ - char package[100]; + char package[MAXNAMELEN]; getPackageName( atts, package ); if (!strlen(package)) @@ -979,6 +986,20 @@ } break; + case STATE_KEEP: { +// const char *channel = attrval( atts, "channel" ); + char package[MAXNAMELEN]; + getPackageName( atts, package ); + + if (!strlen(package)) + { + err( "No package given in <keep>" ); + exit( 1 ); + } + /* FIXME: Needs locks */ + } + break; + default: err( "%s: <%s> unhandled", Current, name ); break; -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org