Move the sending of key sync mails to the DB backend.
PROGS = add lookup gpgwww onak splitkeys onak-mail.pl stripkey
CORE_OBJS = armor.o charfuncs.o decodekey.o getcgi.o hash.o \
keyid.o keyindex.o ll.o mem.o onak-conf.o parsekey.o sha1.o md5.o \
PROGS = add lookup gpgwww onak splitkeys onak-mail.pl stripkey
CORE_OBJS = armor.o charfuncs.o decodekey.o getcgi.o hash.o \
keyid.o keyindex.o ll.o mem.o onak-conf.o parsekey.o sha1.o md5.o \
- log.o photoid.o wordlist.o cleanup.o merge.o
+ log.o photoid.o wordlist.o cleanup.o merge.o sendsync.o
SRCS = armor.c parsekey.c merge.c keyid.c md5.c sha1.c main.c getcgi.c mem.c \
keyindex.c stats.c lookup.c add.c keydb_$(DBTYPE).c ll.c hash.c \
gpgwww.c onak-conf.c charfuncs.c sendsync.c log.c photoid.c \
SRCS = armor.c parsekey.c merge.c keyid.c md5.c sha1.c main.c getcgi.c mem.c \
keyindex.c stats.c lookup.c add.c keydb_$(DBTYPE).c ll.c hash.c \
gpgwww.c onak-conf.c charfuncs.c sendsync.c log.c photoid.c \
KEYDB_OBJ = keydb_$(DBTYPE).o
endif
KEYDB_OBJ = keydb_$(DBTYPE).o
endif
-OBJS = stats.o sendsync.o cleankey.o $(CORE_OBJS) $(KEYDB_OBJ)
+OBJS = stats.o cleankey.o $(CORE_OBJS) $(KEYDB_OBJ)
all: .depend $(PROGS) testparse maxpath sixdegrees splitkeys onak.conf
all: .depend $(PROGS) testparse maxpath sixdegrees splitkeys onak.conf
$(CC) $(LDFLAGS) -o lookup lookup.o cleankey.o $(CORE_OBJS) \
$(KEYDB_OBJ) $(LIBS)
$(CC) $(LDFLAGS) -o lookup lookup.o cleankey.o $(CORE_OBJS) \
$(KEYDB_OBJ) $(LIBS)
-add: add.o cleankey.o sendsync.o $(CORE_OBJS) $(KEYDB_OBJ)
- $(CC) $(LDFLAGS) -o add add.o cleankey.o sendsync.o \
+add: add.o cleankey.o $(CORE_OBJS) $(KEYDB_OBJ)
+ $(CC) $(LDFLAGS) -o add add.o cleankey.o \
$(CORE_OBJS) $(KEYDB_OBJ) $(LIBS)
onak: onak.o cleankey.o $(CORE_OBJS) $(KEYDB_OBJ)
$(CORE_OBJS) $(KEYDB_OBJ) $(LIBS)
onak: onak.o cleankey.o $(CORE_OBJS) $(KEYDB_OBJ)
logthing(LOGTHING_INFO, "%d keys cleaned.",
count);
logthing(LOGTHING_INFO, "%d keys cleaned.",
count);
- count = update_keys(&keys);
+ count = update_keys(&keys, true);
logthing(LOGTHING_NOTICE, "Got %d new keys.",
count);
logthing(LOGTHING_NOTICE, "Got %d new keys.",
count);
free_publickey(keys);
keys = NULL;
}
free_publickey(keys);
keys = NULL;
}
cleanupdb();
} else {
puts("No OpenPGP packets found in input.");
cleanupdb();
} else {
puts("No OpenPGP packets found in input.");
/**
* update_keys - Takes a list of public keys and updates them in the DB.
* @keys: The keys to update in the DB.
/**
* update_keys - Takes a list of public keys and updates them in the DB.
* @keys: The keys to update in the DB.
+ * @sendsync: Should we send a sync mail to our peers.
*
* Takes a list of keys and adds them to the database, merging them with
* the key in the database if it's already present there. The key list is
*
* Takes a list of keys and adds them to the database, merging them with
* the key in the database if it's already present there. The key list is
* we had before to what we have now (ie the set of data that was added to
* the DB). Returns the number of entirely new keys added.
*/
* we had before to what we have now (ie the set of data that was added to
* the DB). Returns the number of entirely new keys added.
*/
-int update_keys(struct openpgp_publickey **keys)
+int update_keys(struct openpgp_publickey **keys, bool sendsync)
{
struct openpgp_publickey *curkey = NULL;
struct openpgp_publickey *oldkey = NULL;
{
struct openpgp_publickey *curkey = NULL;
struct openpgp_publickey *oldkey = NULL;
+ if (sendsync && keys != NULL) {
+ sendkeysync(keys);
+ }
+
return newkeys;
}
#endif /* NEED_UPDATEKEYS */
return newkeys;
}
#endif /* NEED_UPDATEKEYS */
/**
* update_keys - Takes a list of public keys and updates them in the DB.
* @keys: The keys to update in the DB.
/**
* update_keys - Takes a list of public keys and updates them in the DB.
* @keys: The keys to update in the DB.
+ * @sendsync: If we should send a keysync mail.
*
* Takes a list of keys and adds them to the database, merging them with
* the key in the database if it's already present there. The key list is
* update to contain the minimum set of updates required to get from what
* we had before to what we have now (ie the set of data that was added to
* the DB). Returns the number of entirely new keys added.
*
* Takes a list of keys and adds them to the database, merging them with
* the key in the database if it's already present there. The key list is
* update to contain the minimum set of updates required to get from what
* we had before to what we have now (ie the set of data that was added to
* the DB). Returns the number of entirely new keys added.
+ *
+ * If sendsync is true then we send out a keysync mail to our sync peers
+ * with the update.
-int update_keys(struct openpgp_publickey **keys);
+int update_keys(struct openpgp_publickey **keys, bool sendsync);
/**
* keyid2uid - Takes a keyid and returns the primary UID for it.
/**
* keyid2uid - Takes a keyid and returns the primary UID for it.
initdb(false);
logthing(LOGTHING_NOTICE, "Got %d new keys.",
initdb(false);
logthing(LOGTHING_NOTICE, "Got %d new keys.",
+ update_keys(&keys, false));
if (keys != NULL && update) {
flatten_publickey(keys,
&packets,
if (keys != NULL && update) {
flatten_publickey(keys,
&packets,