X-Git-Url: https://the.earth.li/gitweb/?p=onak.git;a=blobdiff_plain;f=keyd.c;h=68f72370b5e04390ccbbc1515f242a1e7e124b49;hp=7fb7eab2c8daad616a3ffed950ccb87fa869913e;hb=adc800dbc424a1e246dd4a82a0c2e88eeda25531;hpb=2458360e75aa46091f60c16e041c07bffe2edefb diff --git a/keyd.c b/keyd.c index 7fb7eab..68f7237 100644 --- a/keyd.c +++ b/keyd.c @@ -13,14 +13,15 @@ * more details. * * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * this program. If not, see . */ #include #include #include +#include #include +#include #include #include #include @@ -397,6 +398,7 @@ static int sock_do(struct onak_dbctx *dbctx, int fd) } break; case KEYD_CMD_STORE: + case KEYD_CMD_UPDATE: if (!keyd_write_reply(fd, KEYD_REPLY_OK)) { ret = 1; } @@ -427,7 +429,8 @@ static int sock_do(struct onak_dbctx *dbctx, int fd) &packets, 0); parse_keys(packets, &key); - dbctx->store_key(dbctx, key, false, false); + dbctx->store_key(dbctx, key, false, + (cmd == KEYD_CMD_UPDATE)); free_packet_list(packets); packets = NULL; free_publickey(key); @@ -606,8 +609,8 @@ static void usage(void) int main(int argc, char *argv[]) { int fd = -1, maxfd, i, clients[MAX_CLIENTS]; - fd_set rfds; - char sockname[1024]; + fd_set rfds = { 0 }; /* Avoid scan-build false report for FD_SET */ + char sockname[100]; char *configfile = NULL; bool foreground = false; int optchar; @@ -653,7 +656,8 @@ int main(int argc, char *argv[]) } stats->started = time(NULL); - snprintf(sockname, 1023, "%s/%s", config.sock_dir, KEYD_SOCKET); + snprintf(sockname, sizeof(sockname) - 1, "%s/%s", + config.sock_dir, KEYD_SOCKET); fd = sock_init(sockname); if (fd != -1) {