Commit b344a071 authored by Bernhard Link's avatar Bernhard Link

SignWith can take multiple arguments to denote multiple keys to sign a repository with

parent 6789124b
2010-01-27
* SignWith can take multiple arguments to denote multiple keys to
sign a repository with.
2010-01-22
* add removesrcs command (like removesrc but can get multiple
source package names)
......
......@@ -529,6 +529,23 @@ retvalue config_getonlyword(struct configiterator *iter, const char *header, che
return RET_OK;
}
retvalue config_getscript(struct configiterator *iter, const char *name, char **value_p) {
char *value, *fullvalue; retvalue r;
r = config_getonlyword(iter, name, NULL, &value);
if( RET_IS_OK(r) ) {
assert( value != NULL && value[0] != '\0' );
if( value[0] != '/' ) {
fullvalue = calc_dirconcat(global.confdir, value);
free(value);
} else
fullvalue = value;
if( fullvalue == NULL )
return RET_ERROR_OOM;
*value_p = fullvalue;
}
return r;
}
retvalue config_geturl(struct configiterator *iter, const char *header, char **result_p) {
char *value, *p;
retvalue r;
......@@ -847,6 +864,62 @@ retvalue config_getwords(struct configiterator *iter, struct strlist *result_p)
return RET_OK;
}
retvalue config_getsignwith(struct configiterator *iter, const char *name, struct strlist *result_p) {
char *value;
retvalue r;
struct strlist data;
int c;
strlist_init(&data);
c = config_nextnonspace(iter);
if( c == EOF ) {
configparser_errorlast(iter,
"Missing value for %s field.", name);
return RET_ERROR;
}
/* if the first character is a '!', a script to start follows */
if( c == '!' ) {
r = strlist_add_dup(&data, "!");
if( RET_WAS_ERROR(r) )
return r;
r = config_getscript(iter, name, &value);
assert( r != RET_NOTHING );
if( RET_WAS_ERROR(r) ) {
strlist_done(&data);
return r;
}
r = strlist_add(&data, value);
if( RET_WAS_ERROR(r) ) {
strlist_done(&data);
return r;
}
strlist_move(result_p, &data);
return RET_OK;
}
/* otherwise each word is stored in the strlist */
r = config_completeword(iter, c, &value);
assert( r != RET_NOTHING );
if( RET_WAS_ERROR(r) )
return r;
r = strlist_add(&data, value);
if( RET_WAS_ERROR(r) )
return r;
while( (r = config_getword(iter, &value)) != RET_NOTHING ) {
if( RET_WAS_ERROR(r) ) {
strlist_done(&data);
return r;
}
r = strlist_add(&data, value);
if( RET_WAS_ERROR(r) ) {
strlist_done(&data);
return r;
}
}
strlist_move(result_p, &data);
return RET_OK;
}
retvalue config_getsplitwords(struct configiterator *iter, UNUSED(const char *header), struct strlist *from_p, struct strlist *into_p) {
char *value, *origin, *destination, *separator;
retvalue r;
......
......@@ -63,6 +63,8 @@ retvalue config_getconstant(struct configiterator *, const struct constant *, in
#define config_getenum(iter,type,constants,result) ({int _val;retvalue _r = config_getconstant(iter, type ## _ ## constants, &_val);*(result) = (enum type)_val;_r;})
retvalue config_completeword(struct configiterator *, char, /*@out@*/char **);
retvalue config_gettimespan(struct configiterator *, const char *, /*@out@*/time_t *);
retvalue config_getscript(struct configiterator *, const char *, /*@out@*/char **);
retvalue config_getsignwith(struct configiterator *, const char *, struct strlist *);
void config_overline(struct configiterator *);
bool config_nextline(struct configiterator *);
retvalue configfile_parse(const char *filename, bool ignoreunknown, configinitfunction, configfinishfunction, const struct configfield *, size_t, void *privdata);
......@@ -103,20 +105,7 @@ static retvalue configparser_ ## sname ## _set_ ## field(UNUSED(void *dummy), co
#define CFscriptSETPROC(sname, field) \
static retvalue configparser_ ## sname ## _set_ ## field(UNUSED(void *dummy), const char *name, void *data, struct configiterator *iter) { \
struct sname *item = data; \
char *value, *fullvalue; retvalue r; \
r = config_getonlyword(iter, name, NULL, &value); \
if( RET_IS_OK(r) ) { \
assert( value != NULL && value[0] != '\0' ); \
if( value[0] != '/' ) { \
fullvalue = calc_dirconcat(global.confdir, value); \
free(value); \
} else \
fullvalue = value; \
if( fullvalue == NULL ) \
return RET_ERROR_OOM; \
item->field = fullvalue; \
} \
return r; \
return config_getscript(iter, name, &item->field); \
}
#define CFlinelistSETPROC(sname, field) \
static retvalue configparser_ ## sname ## _set_ ## field(UNUSED(void *dummy), UNUSED(const char *name), void *data, struct configiterator *iter) { \
......@@ -129,6 +118,11 @@ static retvalue configparser_ ## sname ## _set_ ## field(UNUSED(void *dummy), UN
struct sname *item = data; \
return config_getwords(iter, &item->field); \
}
#define CFsignwithSETPROC(sname, field) \
static retvalue configparser_ ## sname ## _set_ ## field(UNUSED(void *dummy), const char *name, void *data, struct configiterator *iter) { \
struct sname *item = data; \
return config_getsignwith(iter, name, &item->field); \
}
#define CFcheckuniqstrlistSETPROC(sname, field, checker) \
static retvalue configparser_ ## sname ## _set_ ## field(UNUSED(void *dummy), const char *name, void *data, struct configiterator *iter) { \
struct sname *item = data; \
......@@ -304,6 +298,5 @@ static retvalue configparser_ ## sname ## _set_ ## field(UNUSED(void *dummy), UN
#define CFdirSETPROC CFvalueSETPROC
#define CFfileSETPROC CFvalueSETPROC
#define config_getfileinline config_getwordinline
#define CFkeySETPROC CFvalueSETPROC
#endif /* REPREPRO_CONFIGPARSER_H */
......@@ -55,7 +55,6 @@ static retvalue distribution_free(struct distribution *distribution) {
free(distribution->butautomaticupgrades);
free(distribution->label);
free(distribution->description);
free(distribution->signwith);
free(distribution->deb_override);
free(distribution->udeb_override);
free(distribution->dsc_override);
......@@ -63,6 +62,7 @@ static retvalue distribution_free(struct distribution *distribution) {
atomlist_done(&distribution->udebcomponents);
atomlist_done(&distribution->architectures);
atomlist_done(&distribution->components);
strlist_done(&distribution->signwith);
strlist_done(&distribution->updates);
strlist_done(&distribution->pulls);
strlist_done(&distribution->alsoaccept);
......@@ -392,7 +392,7 @@ CFallSETPROC(distribution, butautomaticupgrades)
CFtruthSETPROC2(distribution, readonly, readonly)
CFallSETPROC(distribution, label)
CFallSETPROC(distribution, description)
CFkeySETPROC(distribution, signwith)
CFsignwithSETPROC(distribution, signwith)
CFfileSETPROC(distribution, deb_override)
CFfileSETPROC(distribution, udeb_override)
CFfileSETPROC(distribution, dsc_override)
......
......@@ -43,8 +43,8 @@ struct distribution {
struct strlist updates;
/* which rules to use to pull packages from other distributions */
struct strlist pulls;
/* the key to sign with, may be NULL: */
/*@null@*/char *signwith;
/* the key to sign with, may have no entries to mean unsigned: */
struct strlist signwith;
/* the override file to use by default */
/*@null@*/char *deb_override,*udeb_override,*dsc_override;
/* fake component prefix (and codename antisuffix) for Release files: */
......
......@@ -1319,7 +1319,7 @@ retvalue release_prepare(struct release *release, struct distribution *distribut
writechar('\n');
}
}
r = signedfile_prepare(release->signedfile, distribution->signwith,
r = signedfile_prepare(release->signedfile, &distribution->signwith,
!global.keeptemporaries);
if( RET_WAS_ERROR(r) ) {
signedfile_free(release->signedfile, !global.keeptemporaries);
......
This diff is collapsed.
......@@ -47,11 +47,12 @@ void signatures_free(/*@null@*//*@only@*/struct signatures *);
retvalue signature_readsignedchunk(const char *filename, const char *filenametoshow, char **chunkread, /*@null@*/ /*@out@*/struct signatures **signatures, bool *brokensignature);
struct signedfile;
struct strlist;
retvalue signature_startsignedfile(const char */*directory*/, const char */*basename*/, const char */*inlinebasename*/, /*@out@*/struct signedfile **);
void signedfile_write(struct signedfile *, const void *, size_t);
/* generate signature in temporary file */
retvalue signedfile_prepare(struct signedfile *, const char *options, bool willcleanup);
retvalue signedfile_prepare(struct signedfile *, const struct strlist *, bool /*willcleanup*/);
/* move temporary files to final places */
retvalue signedfile_finalize(struct signedfile *, bool *toolate);
/* may only be called after signedfile_prepare */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment