]> the.earth.li Git - onak.git/blob - keydb_fs.c
Switch keysubkeys to returning an array of fingerprints instead of IDs
[onak.git] / keydb_fs.c
1 /*
2  * keydb_fs.c - Routines to store and fetch keys in a filesystem hierarchy.
3  *
4  * Copyright 2004 Daniel Silverstone <dsilvers@digital-scurf.org>
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the Free
8  * Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * this program; if not, write to the Free Software Foundation, Inc., 51
17  * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19
20 #include <sys/types.h>
21 #include <sys/uio.h>
22 #include <sys/stat.h>
23 #include <errno.h>
24 #include <fcntl.h>
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include <unistd.h>
29 #include <limits.h>
30 #include <dirent.h>
31
32 #include "charfuncs.h"
33 #include "decodekey.h"
34 #include "keydb.h"
35 #include "keyid.h"
36 #include "keystructs.h"
37 #include "ll.h"
38 #include "mem.h"
39 #include "onak-conf.h"
40 #include "parsekey.h"
41 #include "log.h"
42 #include "wordlist.h"
43
44 /* Hack: We should really dynamically allocate our path buffers */
45 #ifndef PATH_MAX
46 #define PATH_MAX 1024
47 #endif
48
49 struct onak_fs_dbctx {
50         int lockfile_fd;
51         bool lockfile_readonly;
52 };
53
54 /*****************************************************************************/
55
56 /* Helper functions */
57
58 #define FNV_offset_basis 2166136261ul
59 #define FNV_mixing_prime 16777619ul
60
61 static uint32_t calchash(uint8_t * ptr)
62 {
63         register uint32_t h = FNV_offset_basis;
64         register uint32_t p = FNV_mixing_prime;
65         register uint32_t n = strlen((char *) ptr);
66         register uint8_t *c = ptr;
67         while (n--) {
68                 h *= p;
69                 h ^= *c++;
70         }
71         return h ? h : 1;       /* prevent a hash of zero happening */
72 }
73
74
75 static void keypath(char *buffer, size_t length, uint64_t _keyid)
76 {
77         uint64_t keyid = _keyid << 32;
78         snprintf(buffer, length, "%s/key/%02X/%02X/%08X/%016" PRIX64,
79                  config.db_dir, (uint8_t) ((keyid >> 56) & 0xFF),
80                  (uint8_t) ((keyid >> 48) & 0xFF),
81                  (uint32_t) (keyid >> 32), _keyid);
82 }
83
84 static void keydir(char *buffer, size_t length, uint64_t _keyid)
85 {
86         uint64_t keyid = _keyid << 32;
87         snprintf(buffer, length, "%s/key/%02X/%02X/%08X", config.db_dir,
88                  (uint8_t) ((keyid >> 56) & 0xFF),
89                  (uint8_t) ((keyid >> 48) & 0xFF),
90                  (uint32_t) (keyid >> 32));
91 }
92
93 static void prove_path_to(uint64_t keyid, char *what)
94 {
95         static char buffer[PATH_MAX];
96         snprintf(buffer, sizeof(buffer), "%s/%s", config.db_dir, what);
97         mkdir(buffer, 0777);
98
99         snprintf(buffer, sizeof(buffer), "%s/%s/%02X", config.db_dir, what,
100                  (uint8_t) ((keyid >> 24) & 0xFF));
101         mkdir(buffer, 0777);
102
103         snprintf(buffer, sizeof(buffer), "%s/%s/%02X/%02X", config.db_dir,
104                  what,
105                  (uint8_t) ((keyid >> 24) & 0xFF),
106                  (uint8_t) ((keyid >> 16) & 0xFF));
107         mkdir(buffer, 0777);
108
109         snprintf(buffer, sizeof(buffer), "%s/%s/%02X/%02X/%08X", config.db_dir,
110                  what,
111                  (uint8_t) ((keyid >> 24) & 0xFF),
112                  (uint8_t) ((keyid >> 16) & 0xFF), (uint32_t) (keyid));
113         mkdir(buffer, 0777);
114 }
115
116 static void wordpath(char *buffer, size_t length, char *word, uint32_t hash,
117                 uint64_t keyid)
118 {
119         snprintf(buffer, length, "%s/words/%02X/%02X/%08X/%s/%016" PRIX64,
120                  config.db_dir, (uint8_t) ((hash >> 24) & 0xFF),
121                  (uint8_t) ((hash >> 16) & 0xFF), hash, word, keyid);
122 }
123
124 static void worddir(char *buffer, size_t length, char *word, uint32_t hash)
125 {
126         snprintf(buffer, length, "%s/words/%02X/%02X/%08X/%s", config.db_dir,
127                  (uint8_t) ((hash >> 24) & 0xFF),
128                  (uint8_t) ((hash >> 16) & 0xFF), hash, word);
129 }
130
131 static void subkeypath(char *buffer, size_t length, uint64_t subkey)
132 {
133         snprintf(buffer, length, "%s/subkeys/%02X/%02X/%08X/%016" PRIX64,
134                  config.db_dir,
135                  (uint8_t) ((subkey >> 24) & 0xFF),
136                  (uint8_t) ((subkey >> 16) & 0xFF),
137                  (uint32_t) (subkey & 0xFFFFFFFF),
138                  subkey);
139 }
140
141 static void subkeydir(char *buffer, size_t length, uint64_t subkey)
142 {
143         snprintf(buffer, length, "%s/subkeys/%02X/%02X/%08X",
144                  config.db_dir,
145                  (uint8_t) ((subkey >> 24) & 0xFF),
146                  (uint8_t) ((subkey >> 16) & 0xFF),
147                  (uint32_t) (subkey & 0xFFFFFFFF));
148 }
149
150 static void skshashpath(char *buffer, size_t length,
151                 const struct skshash *hash)
152 {
153         snprintf(buffer, length, "%s/skshash/%02X/%02X/%02X%02X%02X%02X/"
154                 "%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
155                  config.db_dir,
156                  hash->hash[0], hash->hash[1],
157                  hash->hash[0], hash->hash[1], hash->hash[2], hash->hash[3],
158                  hash->hash[4], hash->hash[5], hash->hash[6], hash->hash[7],
159                  hash->hash[8], hash->hash[9], hash->hash[10], hash->hash[11],
160                  hash->hash[12], hash->hash[13], hash->hash[14],
161                  hash->hash[15]);
162 }
163
164 /*****************************************************************************/
165
166 /**
167  *      starttrans - Start a transaction.
168  */
169 static bool fs_starttrans(struct onak_dbctx *dbctx)
170 {
171         struct onak_fs_dbctx *privctx = (struct onak_fs_dbctx *) dbctx->priv;
172         struct flock lockstruct;
173         int remaining = 20;
174         lockstruct.l_type =
175             F_RDLCK | ((privctx->lockfile_readonly) ? 0 : F_WRLCK);
176         lockstruct.l_whence = SEEK_SET;
177         lockstruct.l_start = 0;
178         lockstruct.l_len = 1;
179
180         while (fcntl(privctx->lockfile_fd, F_SETLK, &lockstruct) == -1) {
181                 if (remaining-- == 0)
182                         return false;   /* Hope to hell that noodles DTRT */
183                 usleep(100);
184         }
185         return true;
186 }
187
188 /**
189  *      endtrans - End a transaction.
190  */
191 static void fs_endtrans(struct onak_dbctx *dbctx)
192 {
193         struct onak_fs_dbctx *privctx = (struct onak_fs_dbctx *) dbctx->priv;
194         struct flock lockstruct;
195
196         lockstruct.l_type = F_UNLCK;
197         lockstruct.l_whence = SEEK_SET;
198         lockstruct.l_start = 0;
199         lockstruct.l_len = 1;
200         fcntl(privctx->lockfile_fd, F_SETLK, &lockstruct);
201 }
202
203 static uint64_t fs_getfullkeyid(struct onak_dbctx *dbctx, uint64_t keyid)
204 {
205         static char buffer[PATH_MAX];
206         DIR *d = NULL;
207         struct dirent *de = NULL;
208         uint64_t ret = 0;
209
210         keydir(buffer, sizeof(buffer), keyid);
211
212         d = opendir(buffer);
213         if (d) {
214                 do {
215                         de = readdir(d);
216                         if (de && de->d_name[0] != '.') {
217                                 ret = strtoull(de->d_name, NULL, 16);
218                         }
219                 } while (de && de->d_name[0] == '.');
220                 closedir(d);    
221         }
222
223         if (ret == 0) {
224                 subkeydir(buffer, sizeof(buffer), keyid);
225
226                 d = opendir(buffer);
227                 if (d) {
228                         do {
229                                 de = readdir(d);
230                                 if (de && de->d_name[0] != '.') {
231                                         ret = strtoull(de->d_name, NULL, 16);
232                                 }
233                         } while (de && de->d_name[0] == '.');
234                         closedir(d);
235                 }
236         }
237
238         return ret;
239 }
240
241 /**
242  *      fetch_key - Given a keyid fetch the key from storage.
243  *      @keyid: The keyid to fetch.
244  *      @publickey: A pointer to a structure to return the key in.
245  *      @intrans: If we're already in a transaction.
246  */
247 static int fs_fetch_key_id(struct onak_dbctx *dbctx,
248               uint64_t keyid,
249               struct openpgp_publickey **publickey,
250               bool intrans)
251 {
252         static char buffer[PATH_MAX];
253         int ret = 0, fd;
254         struct openpgp_packet_list *packets = NULL;
255
256         if (!intrans)
257                 fs_starttrans(dbctx);
258
259         if ((keyid >> 32) == 0)
260                 keyid = fs_getfullkeyid(dbctx, keyid);
261
262         keypath(buffer, sizeof(buffer), keyid);
263         fd = open(buffer, O_RDONLY);
264         if (fd == -1 && errno == ENOENT) {
265                 subkeypath(buffer, sizeof(buffer), keyid);
266                 fd = open(buffer, O_RDONLY);
267         }
268
269         if (fd != -1) {
270                 /* File is present, load it in... */
271                 read_openpgp_stream(file_fetchchar, &fd, &packets, 0);
272                 parse_keys(packets, publickey);
273                 free_packet_list(packets);
274                 packets = NULL;
275                 close(fd);
276                 ret = 1;
277         }
278
279         if (!intrans)
280                 fs_endtrans(dbctx);
281         return ret;
282 }
283
284 /**
285  *      store_key - Takes a key and stores it.
286  *      @publickey: A pointer to the public key to store.
287  *      @intrans: If we're already in a transaction.
288  *      @update: If true the key exists and should be updated.
289  */
290 static int fs_store_key(struct onak_dbctx *dbctx,
291               struct openpgp_publickey *publickey, bool intrans,
292               bool update)
293 {
294         static char buffer[PATH_MAX];
295         static char wbuffer[PATH_MAX];
296         int ret = 0, fd;
297         struct openpgp_packet_list *packets = NULL;
298         struct openpgp_packet_list *list_end = NULL;
299         struct openpgp_publickey *next = NULL;
300         uint64_t keyid;
301         struct ll *wordlist = NULL, *wl = NULL;
302         struct skshash hash;
303         struct openpgp_fingerprint *subkeyids = NULL;
304         uint32_t hashid;
305         int i = 0;
306
307         if (get_keyid(publickey, &keyid) != ONAK_E_OK) {
308                 logthing(LOGTHING_ERROR, "Couldn't find key ID for key.");
309                 return 0;
310         }
311
312         if (!intrans)
313                 fs_starttrans(dbctx);
314
315         prove_path_to(keyid, "key");
316         keypath(buffer, sizeof(buffer), keyid);
317
318         if ((fd =
319              open(buffer, O_WRONLY | (update ? O_TRUNC : O_CREAT),
320                   0644)) != -1) {
321                 next = publickey->next;
322                 publickey->next = NULL;
323                 flatten_publickey(publickey, &packets, &list_end);
324                 publickey->next = next;
325
326                 write_openpgp_stream(file_putchar, &fd, packets);
327                 close(fd);
328                 free_packet_list(packets);
329                 packets = NULL;
330                 ret = 1;
331         }
332
333         if (ret) {
334                 wl = wordlist = makewordlistfromkey(wordlist, publickey);
335                 while (wl) {
336                         uint32_t hash = calchash((uint8_t *) (wl->object));
337                         prove_path_to(hash, "words");
338
339                         worddir(wbuffer, sizeof(wbuffer), wl->object, hash);
340                         mkdir(wbuffer, 0777);
341                         wordpath(wbuffer, sizeof(wbuffer), wl->object, hash,
342                                 keyid);
343                         link(buffer, wbuffer);
344
345                         wl = wl->next;
346                 }
347                 llfree(wordlist, free);
348                 
349                 subkeyids = keysubkeys(publickey);
350                 i = 0;
351                 while (subkeyids != NULL && subkeyids[i].length != 0) {
352                         keyid = fingerprint2keyid(&subkeyids[i]);
353
354                         prove_path_to(keyid, "subkeys");
355
356                         subkeydir(wbuffer, sizeof(wbuffer), keyid);
357                         mkdir(wbuffer, 0777);
358                         subkeypath(wbuffer, sizeof(wbuffer), keyid);
359                         link(buffer, wbuffer);
360
361                         i++;
362                 }
363                 if (subkeyids != NULL) {
364                         free(subkeyids);
365                         subkeyids = NULL;
366                 }
367
368                 get_skshash(publickey, &hash);
369                 hashid = (hash.hash[0] << 24) + (hash.hash[1] << 16) +
370                                 (hash.hash[2] << 8) + hash.hash[3];
371                 prove_path_to(hashid, "skshash");
372                 skshashpath(wbuffer, sizeof(wbuffer), &hash);
373                 link(buffer, wbuffer);
374         }
375
376         if (!intrans)
377                 fs_endtrans(dbctx);
378         return ret;
379 }
380
381 /**
382  *      delete_key - Given a keyid delete the key from storage.
383  *      @keyid: The keyid to delete.
384  *      @intrans: If we're already in a transaction.
385  */
386 static int fs_delete_key(struct onak_dbctx *dbctx, uint64_t keyid, bool intrans)
387 {
388         static char buffer[PATH_MAX];
389         int ret;
390         struct openpgp_publickey *pk = NULL;
391         struct skshash hash;
392         struct ll *wordlist = NULL, *wl = NULL;
393         struct openpgp_fingerprint *subkeyids = NULL;
394         uint64_t subkeyid;
395         int i = 0;
396
397         if ((keyid >> 32) == 0)
398                 keyid = fs_getfullkeyid(dbctx, keyid);
399
400         if (!intrans)
401                 fs_starttrans(dbctx);
402
403         ret = fs_fetch_key_id(dbctx, keyid, &pk, true);
404
405         if (ret) {
406                 logthing(LOGTHING_DEBUG, "Wordlist for key %016" PRIX64,
407                          keyid);
408                 wl = wordlist = makewordlistfromkey(wordlist, pk);
409                 logthing(LOGTHING_DEBUG,
410                          "Wordlist for key %016" PRIX64 " done", keyid);
411                 while (wl) {
412                         uint32_t hash = calchash((uint8_t *) (wl->object));
413                         prove_path_to(hash, "words");
414
415                         wordpath(buffer, sizeof(buffer), wl->object, hash,
416                                 keyid);
417                         unlink(buffer);
418
419                         wl = wl->next;
420                 }
421
422                 subkeyids = keysubkeys(pk);
423                 i = 0;
424                 while (subkeyids != NULL && subkeyids[i].length != 0) {
425                         subkeyid = fingerprint2keyid(&subkeyids[i]);
426                         prove_path_to(subkeyid, "subkeys");
427
428                         subkeypath(buffer, sizeof(buffer), subkeyid);
429                         unlink(buffer);
430
431                         i++;
432                 }
433                 if (subkeyids != NULL) {
434                         free(subkeyids);
435                         subkeyids = NULL;
436                 }
437
438                 get_skshash(pk, &hash);
439                 skshashpath(buffer, sizeof(buffer), &hash);
440                 unlink(buffer);
441         }
442
443         keypath(buffer, sizeof(buffer), keyid);
444         unlink(buffer);
445
446         if (!intrans)
447                 fs_endtrans(dbctx);
448         return 1;
449 }
450
451 static struct ll *internal_get_key_by_word(char *word, struct ll *mct)
452 {
453         struct ll *keys = NULL;
454         DIR *d = NULL;
455         char buffer[PATH_MAX];
456         uint32_t hash = calchash((uint8_t *) (word));
457         struct dirent *de;
458
459         worddir(buffer, sizeof(buffer), word, hash);
460         d = opendir(buffer);
461         logthing(LOGTHING_DEBUG, "Scanning for word %s in dir %s", word,
462                  buffer);
463         if (d) {
464                 do {
465                         de = readdir(d);
466                         if (de && de->d_name[0] != '.') {
467                                 if ((!mct)
468                                     || (llfind(mct, de->d_name,
469                                         (int (*)(const void *, const void *))
470                                                     strcmp) !=
471                                         NULL)) {
472                                         logthing(LOGTHING_DEBUG,
473                                                  "Found %s // %s", word,
474                                                  de->d_name);
475                                         keys =
476                                             lladd(keys,
477                                                   strdup(de->d_name));
478                                 }
479                         }
480                 } while (de);
481                 closedir(d);
482         }
483
484         return keys;
485 }
486
487 /*
488  *      fetch_key_text - Trys to find the keys that contain the supplied text.
489  *      @search: The text to search for.
490  *      @publickey: A pointer to a structure to return the key in.
491  */
492 static int fs_fetch_key_text(struct onak_dbctx *dbctx,
493                    const char *search,
494                    struct openpgp_publickey **publickey)
495 {
496         struct ll *wordlist = NULL, *wl = NULL;
497         struct ll *keylist = NULL;
498         char      *searchtext = NULL;
499         int addedkeys = 0;
500
501         logthing(LOGTHING_DEBUG, "Search was '%s'", search);
502
503         searchtext = strdup(search);
504         wl = wordlist = makewordlist(wordlist, searchtext);
505
506         keylist = internal_get_key_by_word(wordlist->object, NULL);
507
508         if (!keylist) {
509                 llfree(wordlist, NULL);
510                 free(searchtext);
511                 searchtext = NULL;
512                 return 0;
513         }
514
515         wl = wl->next;
516         while (wl) {
517                 struct ll *nkl =
518                     internal_get_key_by_word(wl->object, keylist);
519                 if (!nkl) {
520                         llfree(wordlist, NULL);
521                         llfree(keylist, free);
522                         free(searchtext);
523                         searchtext = NULL;
524                         return 0;
525                 }
526                 llfree(keylist, free);
527                 keylist = nkl;
528                 wl = wl->next;
529         }
530
531         llfree(wordlist, NULL);
532
533         /* Now add the keys... */
534         wl = keylist;
535         while (wl) {
536                 logthing(LOGTHING_DEBUG, "Adding key: %s", wl->object);
537                 addedkeys +=
538                     fs_fetch_key_id(dbctx,
539                               strtoull(wl->object, NULL, 16), publickey,
540                               false);
541                 if (addedkeys >= config.maxkeys)
542                         break;
543                 wl = wl->next;
544         }
545
546         llfree(keylist, free);
547         free(searchtext);
548         searchtext = NULL;
549
550         return addedkeys;
551 }
552
553 /**
554  *      fetch_key_skshash - Given an SKS hash fetch the key from storage.
555  *      @hash: The hash to fetch.
556  *      @publickey: A pointer to a structure to return the key in.
557  *      @intrans: If we're already in a transaction.
558  */
559 static int fs_fetch_key_skshash(struct onak_dbctx *dbctx,
560               const struct skshash *hash,
561               struct openpgp_publickey **publickey)
562 {
563         static char buffer[PATH_MAX];
564         int ret = 0, fd;
565         struct openpgp_packet_list *packets = NULL;
566
567         skshashpath(buffer, sizeof(buffer), hash);
568         if ((fd = open(buffer, O_RDONLY)) != -1) {
569                 read_openpgp_stream(file_fetchchar, &fd, &packets, 0);
570                 parse_keys(packets, publickey);
571                 free_packet_list(packets);
572                 packets = NULL;
573                 close(fd);
574                 ret = 1;
575         }
576
577         return ret;
578 }
579
580 /**
581  *      iterate_keys - call a function once for each key in the db.
582  *      @iterfunc: The function to call.
583  *      @ctx: A context pointer
584  *
585  *      Calls iterfunc once for each key in the database. ctx is passed
586  *      unaltered to iterfunc. This function is intended to aid database dumps
587  *      and statistic calculations.
588  *
589  *      Returns the number of keys we iterated over.
590  */
591 static int fs_iterate_keys(struct onak_dbctx *dbctx,
592                 void (*iterfunc)(void *ctx,
593                 struct openpgp_publickey *key), void *ctx)
594 {
595         return 0;
596 }
597
598 /*
599  * Include the basic keydb routines.
600  */
601 #define NEED_KEYID2UID 1
602 #define NEED_GETKEYSIGS 1
603 #define NEED_UPDATEKEYS 1
604 #define NEED_GET_FP 1
605 #include "keydb.c"
606
607 /**
608  *      cleanupdb - De-initialize the key database.
609  */
610 static void fs_cleanupdb(struct onak_dbctx *dbctx)
611 {
612         struct onak_fs_dbctx *privctx = (struct onak_fs_dbctx *) dbctx->priv;
613
614         /* Mmmm nothing to do here? */
615         close(privctx->lockfile_fd);
616 }
617
618 /**
619  *      initdb - Initialize the key database.
620  */
621 struct onak_dbctx *keydb_fs_init(bool readonly)
622 {
623         char buffer[PATH_MAX];
624         struct onak_dbctx *dbctx;
625         struct onak_fs_dbctx *privctx;
626
627         dbctx = malloc(sizeof(struct onak_dbctx));
628         if (dbctx == NULL) {
629                 return NULL;
630         }
631         dbctx->priv = privctx = malloc(sizeof(*privctx));
632         if (privctx == NULL) {
633                 free(dbctx);
634                 return NULL;
635         }
636
637         privctx->lockfile_readonly = readonly;
638
639         snprintf(buffer, sizeof(buffer), "%s/.lock", config.db_dir);
640
641         if (access(config.db_dir, R_OK | W_OK | X_OK) == -1) {
642                 if (errno != ENOENT) {
643                         logthing(LOGTHING_CRITICAL,
644                                  "Unable to access keydb_fs root of '%s'. (%s)",
645                                  config.db_dir, strerror(errno));
646                         exit(1);        /* Lacking rwx on the key dir */
647                 }
648                 mkdir(config.db_dir, 0777);
649                 privctx->lockfile_fd = open(buffer, O_RDWR | O_CREAT, 0600);
650         }
651         chdir(config.db_dir);
652         privctx->lockfile_fd = open(buffer,
653                                  (privctx->lockfile_readonly) ?
654                                  O_RDONLY : O_RDWR);
655         if (privctx->lockfile_fd == -1)
656                 privctx->lockfile_fd = open(buffer, O_RDWR | O_CREAT, 0600);
657         if (privctx->lockfile_fd == -1) {
658                 logthing(LOGTHING_CRITICAL,
659                          "Unable to open lockfile '%s'. (%s)",
660                          buffer, strerror(errno));
661                 exit(1);        /* Lacking rwx on the key dir */
662         }
663
664         dbctx->cleanupdb                = fs_cleanupdb;
665         dbctx->starttrans               = fs_starttrans;
666         dbctx->endtrans                 = fs_endtrans;
667         dbctx->fetch_key_id             = fs_fetch_key_id;
668         dbctx->fetch_key_fp             = generic_fetch_key_fp;
669         dbctx->fetch_key_text           = fs_fetch_key_text;
670         dbctx->fetch_key_skshash        = fs_fetch_key_skshash;
671         dbctx->store_key                = fs_store_key;
672         dbctx->update_keys              = generic_update_keys;
673         dbctx->delete_key               = fs_delete_key;
674         dbctx->getkeysigs               = generic_getkeysigs;
675         dbctx->cached_getkeysigs        = generic_cached_getkeysigs;
676         dbctx->keyid2uid                = generic_keyid2uid;
677         dbctx->getfullkeyid             = fs_getfullkeyid;
678         dbctx->iterate_keys             = fs_iterate_keys;
679
680         return dbctx;
681 }