GNUnet 0.21.2
gnunet-abd.c File Reference

command line tool to access command line Credential service More...

#include "gnunet_error_codes.h"
#include "platform.h"
#include <gnunet_util_lib.h>
#include <gnunet_abd_service.h>
#include <gnunet_gnsrecord_lib.h>
#include <gnunet_namestore_service.h>
#include "delegate_misc.h"
#include "abd_serialization.h"
Include dependency graph for gnunet-abd.c:

Go to the source code of this file.

Functions

static void do_shutdown (void *cls)
 Task run on shutdown. More...
 
static void do_timeout (void *cls)
 Task run on timeout. More...
 
static void handle_intermediate_result (void *cls, struct GNUNET_ABD_Delegation *dd, bool is_bw)
 
static void handle_collect_result (void *cls, unsigned int d_count, struct GNUNET_ABD_Delegation *dc, unsigned int c_count, struct GNUNET_ABD_Delegate *dele)
 
static void handle_verify_result (void *cls, unsigned int d_count, struct GNUNET_ABD_Delegation *dc, unsigned int c_count, struct GNUNET_ABD_Delegate *dele)
 
static void identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
 Callback invoked from identity service with ego information. More...
 
static int parse_expiration (const char *expirationstring, int *etime_is_rel, uint64_t *etime)
 Parse expiration time. More...
 
static void error_cb (void *cls)
 Function called if lookup fails. More...
 
static void add_continuation (void *cls, enum GNUNET_ErrorCode ec)
 
static void get_existing_record (void *cls, const struct GNUNET_CRYPTO_PrivateKey *zone_key, const char *rec_name, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
 
static void store_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
 
static void sign_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
 
static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c)
 Main function that will be run. More...
 
int main (int argc, char *const *argv)
 The main function for gnunet-gns. More...
 

Variables

static const struct GNUNET_CONFIGURATION_Handlecfg
 Configuration we are using. More...
 
static struct GNUNET_NAMESTORE_Handlens
 Handle to the namestore. More...
 
static struct GNUNET_CRYPTO_PrivateKey zone_pkey
 Private key for the our zone. More...
 
static struct GNUNET_IDENTITY_EgoLookupel
 EgoLookup. More...
 
static struct GNUNET_ABD_Handleabd
 Handle to Credential service. More...
 
static struct GNUNET_TIME_Relative timeout
 Desired timeout for the lookup (default is no timeout). More...
 
static struct GNUNET_ABD_Requestverify_request
 Handle to verify request. More...
 
static struct GNUNET_ABD_Requestcollect_request
 Handle to collect request. More...
 
static struct GNUNET_SCHEDULER_Tasktt
 Task scheduled to handle timeout. More...
 
static int ret = 0
 Return value of the commandline. More...
 
static char * subject
 Subject pubkey string. More...
 
static char * subject_delegate
 Subject delegate string. More...
 
static char * expiration
 Credential TTL. More...
 
struct GNUNET_CRYPTO_PublicKey subject_pkey
 Subject key. More...
 
struct GNUNET_CRYPTO_PublicKey issuer_pkey
 Issuer key. More...
 
static char * issuer_key
 Issuer pubkey string. More...
 
static char * ego_name
 ego More...
 
static char * issuer_attr
 Issuer attribute. More...
 
static int verify
 Verify mode. More...
 
static int collect
 Collect mode. More...
 
static int create_is
 Create mode. More...
 
static int create_ss
 Create mode. More...
 
static int sign_ss
 Create mode. More...
 
static char * import
 Signed issue credentials. More...
 
static int is_private
 Is record private. More...
 
static int forward
 Search direction: forward. More...
 
static int backward
 Search direction: backward. More...
 
enum GNUNET_ABD_AlgoDirectionFlags direction = 0
 API enum, filled and passed for collect/verify. More...
 
static struct GNUNET_NAMESTORE_QueueEntryadd_qe
 Queue entry for the 'add' operation. More...
 
static void * data
 Value in binary format. More...
 
static size_t data_size
 Number of bytes in data. More...
 
static uint32_t type
 Type string converted to DNS type value. More...
 
static char * typestring
 Type of the record to add/remove, NULL to remove all. More...
 
static uint64_t etime
 Expiration string converted to numeric value. More...
 
static int etime_is_rel = GNUNET_SYSERR
 Is expiration time relative or absolute time? More...
 
static char * record_label
 Record label for storing delegations. More...
 

Detailed Description

command line tool to access command line Credential service

Author
Martin Schanzenbach

Definition in file gnunet-abd.c.

Function Documentation

◆ do_shutdown()

static void do_shutdown ( void *  cls)
static

Task run on shutdown.

Cleans up everything.

Parameters
clsunused

Definition at line 220 of file gnunet-abd.c.

221{
222 if (NULL != verify_request)
223 {
225 verify_request = NULL;
226 }
227 if (NULL != abd)
228 {
230 abd = NULL;
231 }
232 if (NULL != tt)
233 {
235 tt = NULL;
236 }
237 if (NULL != el)
238 {
240 el = NULL;
241 }
242 if (NULL != add_qe)
243 {
245 add_qe = NULL;
246 }
247 if (NULL != ns)
248 {
250 ns = NULL;
251 }
252}
static struct GNUNET_NAMESTORE_QueueEntry * add_qe
Queue entry for the 'add' operation.
Definition: gnunet-abd.c:178
static struct GNUNET_IDENTITY_EgoLookup * el
EgoLookup.
Definition: gnunet-abd.c:52
static struct GNUNET_SCHEDULER_Task * tt
Task scheduled to handle timeout.
Definition: gnunet-abd.c:77
static struct GNUNET_NAMESTORE_Handle * ns
Handle to the namestore.
Definition: gnunet-abd.c:42
static struct GNUNET_ABD_Handle * abd
Handle to Credential service.
Definition: gnunet-abd.c:57
static struct GNUNET_ABD_Request * verify_request
Handle to verify request.
Definition: gnunet-abd.c:67
void GNUNET_ABD_disconnect(struct GNUNET_ABD_Handle *handle)
Shutdown connection with the ABD service.
Definition: abd_api.c:376
void GNUNET_ABD_request_cancel(struct GNUNET_ABD_Request *lr)
Cancel pending verify request.
Definition: abd_api.c:399
void GNUNET_IDENTITY_ego_lookup_cancel(struct GNUNET_IDENTITY_EgoLookup *el)
Abort ego lookup attempt.
void GNUNET_NAMESTORE_disconnect(struct GNUNET_NAMESTORE_Handle *h)
Disconnect from the namestore service (and free associated resources).
void GNUNET_NAMESTORE_cancel(struct GNUNET_NAMESTORE_QueueEntry *qe)
Cancel a namestore operation.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:981

References abd, add_qe, el, GNUNET_ABD_disconnect(), GNUNET_ABD_request_cancel(), GNUNET_IDENTITY_ego_lookup_cancel(), GNUNET_NAMESTORE_cancel(), GNUNET_NAMESTORE_disconnect(), GNUNET_SCHEDULER_cancel(), ns, tt, and verify_request.

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_timeout()

static void do_timeout ( void *  cls)
static

Task run on timeout.

Triggers shutdown.

Parameters
clsunused

Definition at line 261 of file gnunet-abd.c.

262{
263 tt = NULL;
265}
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:567

References GNUNET_SCHEDULER_shutdown(), and tt.

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_intermediate_result()

static void handle_intermediate_result ( void *  cls,
struct GNUNET_ABD_Delegation dd,
bool  is_bw 
)
static

Definition at line 269 of file gnunet-abd.c.

272{
273 char *prefix = "";
274 if (is_bw)
275 prefix = "Backward -";
276 else
277 prefix = "Forward -";
278
279 printf ("%s Intermediate result: %s.%s <- %s.%s\n",
280 prefix,
285}
static int prefix
If printing the value of PREFIX has been requested.
Definition: gnunet-config.c:66
char * GNUNET_CRYPTO_public_key_to_string(const struct GNUNET_CRYPTO_PublicKey *key)
Creates a (Base32) string representation of the public key.
Definition: crypto_pkey.c:394
struct GNUNET_CRYPTO_PublicKey subject_key
Public key of the subject this attribute was delegated to.
const char * issuer_attribute
The attribute.
const char * subject_attribute
The attribute.
struct GNUNET_CRYPTO_PublicKey issuer_key
The issuer of the delegation.

References GNUNET_CRYPTO_public_key_to_string(), GNUNET_ABD_Delegation::issuer_attribute, GNUNET_ABD_Delegation::issuer_key, prefix, GNUNET_ABD_Delegation::subject_attribute, and GNUNET_ABD_Delegation::subject_key.

Referenced by identity_cb(), and run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_collect_result()

static void handle_collect_result ( void *  cls,
unsigned int  d_count,
struct GNUNET_ABD_Delegation dc,
unsigned int  c_count,
struct GNUNET_ABD_Delegate dele 
)
static

Definition at line 289 of file gnunet-abd.c.

294{
295 int i;
296 char *line;
297
298 verify_request = NULL;
299 if (NULL != dele)
300 {
301 for (i = 0; i < c_count; i++)
302 {
304 printf ("%s\n", line);
306 }
307 }
308 else
309 {
310 printf ("Received NULL\n");
311 }
312
314}
char * GNUNET_ABD_delegate_to_string(const struct GNUNET_ABD_Delegate *cred)
Definition: delegate_misc.c:37
static char * line
Desired phone line (string to be converted to a hash).
#define GNUNET_free(ptr)
Wrapper around free.

References GNUNET_ABD_delegate_to_string(), GNUNET_free, GNUNET_SCHEDULER_shutdown(), line, and verify_request.

Referenced by identity_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_verify_result()

static void handle_verify_result ( void *  cls,
unsigned int  d_count,
struct GNUNET_ABD_Delegation dc,
unsigned int  c_count,
struct GNUNET_ABD_Delegate dele 
)
static

Definition at line 318 of file gnunet-abd.c.

323{
324 int i;
325 char *iss_key;
326 char *sub_key;
327
328 verify_request = NULL;
329 if (NULL == dele)
330 ret = 1;
331 else
332 {
333 printf ("Delegation Chain:\n");
334 for (i = 0; i < d_count; i++)
335 {
337 sub_key = GNUNET_CRYPTO_public_key_to_string (&dc[i].subject_key);
338
339 if (0 != dc[i].subject_attribute_len)
340 {
341 printf ("(%d) %s.%s <- %s.%s\n",
342 i,
343 iss_key,
344 dc[i].issuer_attribute,
345 sub_key,
346 dc[i].subject_attribute);
347 }
348 else
349 {
350 printf ("(%d) %s.%s <- %s\n",
351 i,
352 iss_key,
353 dc[i].issuer_attribute,
354 sub_key);
355 }
356 GNUNET_free (iss_key);
357 GNUNET_free (sub_key);
358 }
359 printf ("\nDelegate(s):\n");
360 for (i = 0; i < c_count; i++)
361 {
363 sub_key = GNUNET_CRYPTO_public_key_to_string (&dele[i].subject_key);
364 printf ("%s.%s <- %s\n", iss_key, dele[i].issuer_attribute, sub_key);
365 GNUNET_free (iss_key);
366 GNUNET_free (sub_key);
367 }
368 printf ("Successful.\n");
369 }
370
372}
static char * issuer_key
Issuer pubkey string.
Definition: gnunet-abd.c:113
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:82
static struct GNUNET_FS_DownloadContext * dc

References dc, GNUNET_CRYPTO_public_key_to_string(), GNUNET_free, GNUNET_SCHEDULER_shutdown(), issuer_key, ret, and verify_request.

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ identity_cb()

static void identity_cb ( void *  cls,
struct GNUNET_IDENTITY_Ego ego 
)
static

Callback invoked from identity service with ego information.

An ego of NULL means the ego was not found.

Parameters
clsclosure with the configuration
egoan ego known to identity service, or NULL

Definition at line 383 of file gnunet-abd.c.

384{
385 const struct GNUNET_CRYPTO_PrivateKey *privkey;
386
387 el = NULL;
388 if (NULL == ego)
389 {
390 if (NULL != ego_name)
391 {
392 fprintf (stderr,
393 _ ("Ego `%s' not known to identity service\n"),
394 ego_name);
395 }
397 return;
398 }
399
400 if (GNUNET_YES == collect)
401 {
402
403 if (GNUNET_OK !=
405 &issuer_pkey))
406 {
407 fprintf (stderr,
408 _ ("Issuer public key `%s' is not well-formed\n"),
409 issuer_key);
411 }
413
417 privkey,
418 direction,
420 NULL,
422 NULL);
423 return;
424 }
426}
static struct GNUNET_ABD_Request * collect_request
Handle to collect request.
Definition: gnunet-abd.c:72
static char * issuer_attr
Issuer attribute.
Definition: gnunet-abd.c:123
struct GNUNET_CRYPTO_PublicKey issuer_pkey
Issuer key.
Definition: gnunet-abd.c:107
static int collect
Collect mode.
Definition: gnunet-abd.c:133
static void handle_collect_result(void *cls, unsigned int d_count, struct GNUNET_ABD_Delegation *dc, unsigned int c_count, struct GNUNET_ABD_Delegate *dele)
Definition: gnunet-abd.c:289
static char * ego_name
ego
Definition: gnunet-abd.c:118
enum GNUNET_ABD_AlgoDirectionFlags direction
API enum, filled and passed for collect/verify.
Definition: gnunet-abd.c:173
static void handle_intermediate_result(void *cls, struct GNUNET_ABD_Delegation *dd, bool is_bw)
Definition: gnunet-abd.c:269
struct GNUNET_ABD_Request * GNUNET_ABD_collect(struct GNUNET_ABD_Handle *handle, const struct GNUNET_CRYPTO_PublicKey *issuer_key, const char *issuer_attribute, const struct GNUNET_CRYPTO_PrivateKey *subject_key, enum GNUNET_ABD_AlgoDirectionFlags direction, GNUNET_ABD_CredentialResultProcessor proc, void *proc_cls, GNUNET_ABD_IntermediateResultProcessor proc2, void *proc2_cls)
Performs attribute collection.
Definition: abd_api.c:423
const struct GNUNET_CRYPTO_PrivateKey * GNUNET_IDENTITY_ego_get_private_key(const struct GNUNET_IDENTITY_Ego *ego)
Obtain the ECC key associated with a ego.
Definition: identity_api.c:517
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_public_key_from_string(const char *str, struct GNUNET_CRYPTO_PublicKey *key)
Parses a (Base32) string representation of the public key.
Definition: crypto_pkey.c:414
@ GNUNET_OK
@ GNUNET_YES
#define _(String)
GNU gettext support macro.
Definition: platform.h:178
A private key for an identity as per LSD0001.

References _, abd, collect, collect_request, direction, ego_name, el, GNUNET_ABD_collect(), GNUNET_CRYPTO_public_key_from_string(), GNUNET_IDENTITY_ego_get_private_key(), GNUNET_OK, GNUNET_SCHEDULER_shutdown(), GNUNET_YES, handle_collect_result(), handle_intermediate_result(), issuer_attr, issuer_key, and issuer_pkey.

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_expiration()

static int parse_expiration ( const char *  expirationstring,
int *  etime_is_rel,
uint64_t *  etime 
)
static

Parse expiration time.

Parameters
expirationstringtext to parse
[out]etime_is_relset to GNUNET_YES if time is relative
[out]etimeset to expiration time (abs or rel)
Returns
GNUNET_OK on success

Definition at line 438 of file gnunet-abd.c.

441{
442 // copied from namestore/gnunet-namestore.c
443 struct GNUNET_TIME_Relative etime_rel;
444 struct GNUNET_TIME_Absolute etime_abs;
445
446 if (0 == strcmp (expirationstring, "never"))
447 {
448 *etime = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
450 return GNUNET_OK;
451 }
452 if (GNUNET_OK ==
454 {
456 *etime = etime_rel.rel_value_us;
458 "Storing record with relative expiration time of %s\n",
460 return GNUNET_OK;
461 }
462 if (GNUNET_OK ==
464 {
466 *etime = etime_abs.abs_value_us;
468 "Storing record with absolute expiration time of %s\n",
470 return GNUNET_OK;
471 }
472 return GNUNET_SYSERR;
473}
static int etime_is_rel
Is expiration time relative or absolute time?
Definition: gnunet-abd.c:207
static uint64_t etime
Expiration string converted to numeric value.
Definition: gnunet-abd.c:202
static char * expirationstring
Desired expiration time.
#define GNUNET_log(kind,...)
@ GNUNET_NO
@ GNUNET_SYSERR
@ GNUNET_ERROR_TYPE_DEBUG
enum GNUNET_GenericReturnValue GNUNET_STRINGS_fancy_time_to_relative(const char *fancy_time, struct GNUNET_TIME_Relative *rtime)
Convert a given fancy human-readable time to our internal representation.
Definition: strings.c:260
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
Definition: strings.c:570
const char * GNUNET_STRINGS_absolute_time_to_string(struct GNUNET_TIME_Absolute t)
Like asctime, except for GNUnet time.
Definition: strings.c:617
#define GNUNET_TIME_UNIT_FOREVER_ABS
Constant used to specify "forever".
enum GNUNET_GenericReturnValue GNUNET_STRINGS_fancy_time_to_absolute(const char *fancy_time, struct GNUNET_TIME_Absolute *atime)
Convert a given fancy human-readable time to our internal representation.
Definition: strings.c:302
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.

References GNUNET_TIME_Absolute::abs_value_us, etime, etime_is_rel, expirationstring, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_NO, GNUNET_OK, GNUNET_STRINGS_absolute_time_to_string(), GNUNET_STRINGS_fancy_time_to_absolute(), GNUNET_STRINGS_fancy_time_to_relative(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_SYSERR, GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_YES, and GNUNET_TIME_Relative::rel_value_us.

Referenced by store_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ error_cb()

static void error_cb ( void *  cls)
static

Function called if lookup fails.

Definition at line 480 of file gnunet-abd.c.

481{
482 fprintf (stderr, "Error occurred during lookup, shutting down.\n");
484 return;
485}

References GNUNET_SCHEDULER_shutdown().

Referenced by GNUNET_NAMESTORE_records_lookup(), GNUNET_NAMESTORE_records_lookup2(), GNUNET_NAMESTORE_zone_iteration_start(), GNUNET_NAMESTORE_zone_iteration_start2(), GNUNET_NAMESTORE_zone_monitor_start(), GNUNET_NAMESTORE_zone_monitor_start2(), GNUNET_NAMESTORE_zone_to_name(), GNUNET_PEERSTORE_monitor_start(), GNUNET_RECLAIM_get_attributes_start(), GNUNET_RECLAIM_get_credentials_start(), GNUNET_RECLAIM_ticket_iteration_start(), records_lookup(), and store_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_continuation()

static void add_continuation ( void *  cls,
enum GNUNET_ErrorCode  ec 
)
static

Definition at line 489 of file gnunet-abd.c.

490{
491 struct GNUNET_NAMESTORE_QueueEntry **qe = cls;
492 *qe = NULL;
493
494 if (GNUNET_EC_NONE == ec)
495 printf ("Adding successful.\n");
496 else
497 fprintf (stderr, "Error: `%s'.\n", GNUNET_ErrorCode_get_hint (ec));
498
500}
static struct GNUNET_DATASTORE_QueueEntry * qe
Current operation.
const char * GNUNET_ErrorCode_get_hint(enum GNUNET_ErrorCode ec)
Returns a hint for a given error code.
@ GNUNET_EC_NONE
No error (success).
An QueueEntry used to store information for a pending NAMESTORE record operation.
Definition: namestore_api.c:49

References GNUNET_EC_NONE, GNUNET_ErrorCode_get_hint(), GNUNET_SCHEDULER_shutdown(), and qe.

Referenced by get_existing_record().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_existing_record()

static void get_existing_record ( void *  cls,
const struct GNUNET_CRYPTO_PrivateKey zone_key,
const char *  rec_name,
unsigned int  rd_count,
const struct GNUNET_GNSRECORD_Data rd 
)
static

Definition at line 504 of file gnunet-abd.c.

509{
510 struct GNUNET_GNSRECORD_Data *rde;
511 struct GNUNET_GNSRECORD_Data*rdn =
512 GNUNET_malloc (sizeof(*rdn) * (rd_count + 1));
513
514 memset (rdn, 0, sizeof (struct GNUNET_GNSRECORD_Data));
515 GNUNET_memcpy (&rdn[1], rd,
516 rd_count * sizeof (struct GNUNET_GNSRECORD_Data));
517 rde = &rdn[0];
518 rde->data = data;
519 rde->data_size = data_size;
520 rde->record_type = type;
521
522 // Set flags
523 if (GNUNET_YES == is_private)
525 rde->expiration_time = etime;
528 else if (GNUNET_NO != etime_is_rel)
530
531 GNUNET_assert (NULL != rec_name);
533 &zone_pkey,
534 rec_name,
535 rd_count + 1,
536 rde,
538 &add_qe);
539 GNUNET_free (rdn);
540 return;
541}
static struct GNUNET_CRYPTO_PrivateKey zone_pkey
Private key for the our zone.
Definition: gnunet-abd.c:47
static int is_private
Is record private.
Definition: gnunet-abd.c:158
static void * data
Value in binary format.
Definition: gnunet-abd.c:183
static void add_continuation(void *cls, enum GNUNET_ErrorCode ec)
Definition: gnunet-abd.c:489
static uint32_t type
Type string converted to DNS type value.
Definition: gnunet-abd.c:193
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:188
static unsigned int rd_count
Number of records for currently parsed set.
static struct GNUNET_GNSRECORD_Data rd[50]
The record data under a single label.
@ GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION
This expiration time of the record is a relative time (not an absolute time).
@ GNUNET_GNSRECORD_RF_PRIVATE
This is a private record of this peer and it should thus not be published.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_malloc(size)
Wrapper around malloc.
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_record_set_store(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *pkey, const char *label, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd, GNUNET_NAMESTORE_ContinuationWithStatus cont, void *cont_cls)
Store an item in the namestore.
uint32_t record_type
Type of the GNS/DNS record.
const void * data
Binary value stored in the DNS record.
size_t data_size
Number of bytes in data.
enum GNUNET_GNSRECORD_Flags flags
Flags for the record.
uint64_t expiration_time
Expiration time for the DNS record.

References add_continuation(), add_qe, data, GNUNET_GNSRECORD_Data::data, data_size, GNUNET_GNSRECORD_Data::data_size, etime, etime_is_rel, GNUNET_GNSRECORD_Data::expiration_time, GNUNET_GNSRECORD_Data::flags, GNUNET_assert, GNUNET_free, GNUNET_GNSRECORD_RF_PRIVATE, GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION, GNUNET_malloc, GNUNET_memcpy, GNUNET_NAMESTORE_record_set_store(), GNUNET_NO, GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_YES, is_private, ns, rd, rd_count, GNUNET_GNSRECORD_Data::record_type, type, and zone_pkey.

Referenced by store_cb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ store_cb()

static void store_cb ( void *  cls,
struct GNUNET_IDENTITY_Ego ego 
)
static

Definition at line 545 of file gnunet-abd.c.

546{
547 const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
548 struct GNUNET_ABD_Delegate *cred;
549 struct GNUNET_CRYPTO_PublicKey zone_pubkey;
550 char *subject_pubkey_str;
551 char *zone_pubkey_str;
552
553 el = NULL;
554
556 if (NULL == ns)
557 {
559 _ ("Failed to connect to namestore\n"));
561 return;
562 }
563
564 if (NULL == ego)
565 {
567 _("Ego does not exist!\n"));
569 return;
570 }
571
572 // Key handling
574
576 {
577 // Parse import
578 cred = GNUNET_ABD_delegate_from_string (import);
579
580 if (NULL == cred)
581 {
582 fprintf (stderr,
583 "%s is not a valid credential\n", import);
585 return;
586 }
587
588 // Get import subject public key string
589 subject_pubkey_str =
591
592 // Get zone public key string
593 GNUNET_IDENTITY_ego_get_public_key (ego, &zone_pubkey);
594 zone_pubkey_str =
596
597 // Check if the subject key in the signed import matches the zone's key it is issued to
598 if (strcmp (zone_pubkey_str, subject_pubkey_str) != 0)
599 {
600 fprintf (stderr,
601 "Import signed delegate does not match this ego's public key.\n");
602 GNUNET_free (cred);
604 return;
605 }
606
607 // Expiration
610
611 // Prepare the data to be store in the record
612 data_size = GNUNET_ABD_delegate_serialize (cred, (char **) &data);
613 GNUNET_free (cred);
614 }
615 else
616 {
617 // For all other types e.g. GNUNET_GNSRECORD_TYPE_ATTRIBUTE
618 if (GNUNET_OK !=
620 {
621 if (typestring == NULL)
622 {
623 fputs ("Value for unknown record type not well-formed.\n", stderr);
624 }
625 else if (subject == NULL)
626 {
627 fprintf (stderr,
628 "Value for record type `%s' not well-formed.\n",
629 typestring);
630 }
631 else
632 {
633 fprintf (stderr,
634 "Value `%s' invalid for record type `%s'\n",
635 subject,
636 typestring);
637 }
639 return;
640 }
641
642 // Take care of expiration
643 if (NULL == expiration)
644 {
645 fprintf (stderr, "Missing option -e for operation 'create'\n");
647 return;
648 }
650 {
651 fprintf (stderr, "Invalid time format `%s'\n", expiration);
653 return;
654 }
655 }
656
657 // Start lookup
659 &zone_pkey,
661 &error_cb,
662 NULL,
664 NULL);
665 return;
666}
int GNUNET_ABD_delegate_serialize(struct GNUNET_ABD_Delegate *dele, char **data)
struct GNUNET_ABD_Delegate * GNUNET_ABD_delegate_from_string(const char *s)
Definition: delegate_misc.c:80
static char * record_label
Record label for storing delegations.
Definition: gnunet-abd.c:212
static char * expiration
Credential TTL.
Definition: gnunet-abd.c:97
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
Definition: gnunet-abd.c:37
static int parse_expiration(const char *expirationstring, int *etime_is_rel, uint64_t *etime)
Parse expiration time.
Definition: gnunet-abd.c:438
static void error_cb(void *cls)
Function called if lookup fails.
Definition: gnunet-abd.c:480
static char * subject
Subject pubkey string.
Definition: gnunet-abd.c:87
static void get_existing_record(void *cls, const struct GNUNET_CRYPTO_PrivateKey *zone_key, const char *rec_name, unsigned int rd_count, const struct GNUNET_GNSRECORD_Data *rd)
Definition: gnunet-abd.c:504
static char * typestring
Type of the record to add/remove, NULL to remove all.
Definition: gnunet-abd.c:198
int GNUNET_GNSRECORD_string_to_value(uint32_t type, const char *s, void **data, size_t *data_size)
Convert human-readable version of the value s of a record of type type to the respective binary repre...
Definition: gnsrecord.c:177
void GNUNET_IDENTITY_ego_get_public_key(struct GNUNET_IDENTITY_Ego *ego, struct GNUNET_CRYPTO_PublicKey *pk)
Get the identifier (public key) of an ego.
Definition: identity_api.c:529
@ GNUNET_ERROR_TYPE_ERROR
struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_lookup(struct GNUNET_NAMESTORE_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *pkey, const char *label, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_NAMESTORE_RecordMonitor rm, void *rm_cls)
Lookup an item in the namestore.
struct GNUNET_NAMESTORE_Handle * GNUNET_NAMESTORE_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the namestore service.
#define GNUNET_GNSRECORD_TYPE_DELEGATE
For ABD policies.
struct GNUNET_TIME_Absolute expiration
Expiration of this credential.
struct GNUNET_CRYPTO_PublicKey subject_key
Public key of the subject this credential was issued to.
An identity key as per LSD0001.
uint64_t abs_value_us
The actual value.

References _, GNUNET_TIME_Absolute::abs_value_us, add_qe, cfg, data, data_size, el, error_cb(), etime, etime_is_rel, expiration, GNUNET_ABD_Delegate::expiration, get_existing_record(), GNUNET_ABD_delegate_from_string(), GNUNET_ABD_delegate_serialize(), GNUNET_CRYPTO_public_key_to_string(), GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_GNSRECORD_string_to_value(), GNUNET_GNSRECORD_TYPE_DELEGATE, GNUNET_IDENTITY_ego_get_private_key(), GNUNET_IDENTITY_ego_get_public_key(), GNUNET_log, GNUNET_NAMESTORE_connect(), GNUNET_NAMESTORE_records_lookup(), GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_shutdown(), ns, parse_expiration(), record_label, subject, GNUNET_ABD_Delegate::subject_key, type, typestring, and zone_pkey.

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sign_cb()

static void sign_cb ( void *  cls,
struct GNUNET_IDENTITY_Ego ego 
)
static

Definition at line 670 of file gnunet-abd.c.

671{
672 const struct GNUNET_CRYPTO_PrivateKey *privkey;
673 struct GNUNET_ABD_Delegate *dele;
674 struct GNUNET_TIME_Absolute etime_abs;
675 char *res;
676
677 el = NULL;
678
679 // work on expiration time
680 if (NULL == expiration)
681 {
682 fprintf (stderr, "Please specify a TTL\n");
684 return;
685 }
686 else if (GNUNET_OK !=
688 {
689 fprintf (stderr,
690 "%s is not a valid ttl! Only absolute times are accepted!\n",
691 expiration);
693 return;
694 }
695
696 // If contains a space - split it by the first space only - assume first entry is subject followed by attribute(s)
697 char *subject_pubkey_str;
698 char *subject_attr = NULL;
699 char *token;
700
701 // Subject Public Key
702 token = strtok (subject, " ");
703 subject_pubkey_str = token;
704 // Subject Attribute(s)
705 token = strtok (NULL, " ");
706 if (NULL != token)
707 {
708 subject_attr = token;
709 }
710
711 // work on keys
713
714 if (NULL == subject_pubkey_str)
715 {
716 fprintf (stderr,
717 "Subject pubkey not given\n");
719 return;
720 }
721 if (GNUNET_OK !=
722 GNUNET_CRYPTO_public_key_from_string (subject_pubkey_str,
723 &subject_pkey))
724 {
725 fprintf (stderr,
726 "Subject public key `%s' is not well-formed\n",
727 subject_pubkey_str);
729 return;
730 }
731
732 // Sign delegate
733 dele = GNUNET_ABD_delegate_issue (privkey,
736 subject_attr,
737 &etime_abs);
739 GNUNET_free (dele);
740 printf ("%s\n", res);
741
743 ego_name = NULL;
744
746}
struct GNUNET_CRYPTO_PublicKey subject_pkey
Subject key.
Definition: gnunet-abd.c:102
static char * res
Currently read line or NULL on EOF.
struct GNUNET_ABD_Delegate * GNUNET_ABD_delegate_issue(const struct GNUNET_CRYPTO_PrivateKey *issuer, struct GNUNET_CRYPTO_PublicKey *subject, const char *iss_attr, const char *sub_attr, struct GNUNET_TIME_Absolute *expiration)
Issue an attribute to a subject.

References ego_name, el, expiration, GNUNET_ABD_delegate_issue(), GNUNET_ABD_delegate_to_string(), GNUNET_CRYPTO_public_key_from_string(), GNUNET_free, GNUNET_IDENTITY_ego_get_private_key(), GNUNET_OK, GNUNET_SCHEDULER_shutdown(), GNUNET_STRINGS_fancy_time_to_absolute(), issuer_attr, res, subject, and subject_pkey.

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ run()

static void run ( void *  cls,
char *const *  args,
const char *  cfgfile,
const struct GNUNET_CONFIGURATION_Handle c 
)
static

Main function that will be run.

Parameters
clsclosure
argsremaining command-line arguments
cfgfilename of the configuration file used (for saving, can be NULL!)
cconfiguration

Definition at line 758 of file gnunet-abd.c.

762{
763 cfg = c;
764
767
768 // Check relevant cmdline parameters
769 if (GNUNET_YES == create_is)
770 {
771 if (NULL == ego_name)
772 {
773 fprintf (stderr, "Missing option '-ego'\n");
775 return;
776 }
777 if (NULL == issuer_attr)
778 {
779 fprintf (stderr, "Missing option '-attribute' for issuer attribute\n");
781 return;
782 }
783 if (NULL == subject)
784 {
785 fprintf (stderr, "Missing option -subject for operation 'create'.'\n");
787 return;
788 }
789
790 // Lookup ego, on success call store_cb and store as ATTRIBUTE type
794 return;
795 }
796
797 if (GNUNET_YES == create_ss)
798 {
799
800 // check if signed parameter has been passed in cmd line call
801 if (NULL == import)
802 {
803 fprintf (stderr, "'import' required\n");
805 return;
806 }
807
810 // Store subject side
812
813 return;
814 }
815
816 if (GNUNET_YES == sign_ss)
817 {
818 if (NULL == ego_name)
819 {
820 fprintf (stderr, "ego required\n");
822 return;
823 }
824 if (NULL == subject)
825 {
826 fprintf (stderr, "Subject public key needed\n");
828 return;
829 }
830
831 // lookup ego and call function sign_cb on success
833 return;
834 }
835
836 if ((GNUNET_NO == forward) && (GNUNET_NO == backward))
837 {
838 // set default: bidirectional
841 }
842 if (GNUNET_YES == forward)
844 if (GNUNET_YES == backward)
846
847 if (GNUNET_YES == collect)
848 {
849 if (NULL == issuer_key)
850 {
851 fprintf (stderr, _ ("Issuer public key not well-formed\n"));
853 return;
854 }
855
857
858 if (NULL == abd)
859 {
860 fprintf (stderr, _ ("Failed to connect to ABD\n"));
862 return;
863 }
864 if (NULL == issuer_attr)
865 {
866 fprintf (stderr, _ ("You must provide issuer the attribute\n"));
868 return;
869 }
870
871 if (NULL == ego_name)
872 {
873 fprintf (stderr, _ ("ego required\n"));
875 return;
876 }
878 return;
879 }
880
881 if (NULL == subject)
882 {
883 fprintf (stderr, _ ("Subject public key needed\n"));
885 return;
886 }
888 &subject_pkey))
889 {
890 fprintf (stderr,
891 _ ("Subject public key `%s' is not well-formed\n"),
892 subject);
894 return;
895 }
896
897 if (GNUNET_YES == verify)
898 {
899 if (NULL == issuer_key)
900 {
901 fprintf (stderr, _ ("Issuer public key not well-formed\n"));
903 return;
904 }
905 if (GNUNET_OK !=
907 &issuer_pkey))
908 {
909 fprintf (stderr,
910 _ ("Issuer public key `%s' is not well-formed\n"),
911 issuer_key);
913 return;
914 }
916
917 if (NULL == abd)
918 {
919 fprintf (stderr, _ ("Failed to connect to ABD\n"));
921 return;
922 }
923 if ((NULL == issuer_attr) || (NULL == subject_delegate))
924 {
925 fprintf (stderr, _ ("You must provide issuer and subject attributes\n"));
927 return;
928 }
929
930 // Subject credentials are comma separated
931 char *tmp = GNUNET_strdup (subject_delegate);
932 char *tok = strtok (tmp, ",");
933 if (NULL == tok)
934 {
935 fprintf (stderr, "Invalid subject credentials\n");
936 GNUNET_free (tmp);
938 return;
939 }
940 int count = 1;
941 int i;
942 while (NULL != (tok = strtok (NULL, ",")))
943 count++;
944 struct GNUNET_ABD_Delegate*delegates =
945 GNUNET_malloc (sizeof(*delegates) * count);
946 struct GNUNET_ABD_Delegate *dele;
947 GNUNET_free (tmp);
949 tok = strtok (tmp, ",");
950 for (i = 0; i < count; i++)
951 {
953 GNUNET_memcpy (&delegates[i],
954 dele,
955 sizeof (struct GNUNET_ABD_Delegate));
956 delegates[i].issuer_attribute = GNUNET_strdup (dele->issuer_attribute);
957 tok = strtok (NULL, ",");
958 GNUNET_free (dele);
959 }
960
965 count,
966 delegates,
967 direction,
969 NULL,
971 NULL);
972 for (i = 0; i < count; i++)
973 {
974 GNUNET_free_nz ((char *) delegates[i].issuer_attribute);
975 delegates[i].issuer_attribute = NULL;
976 }
977 GNUNET_free (tmp);
978 GNUNET_free (delegates);
979 }
980 else
981 {
982 fprintf (stderr,
983 _ (
984 "Please specify name to lookup, subject key and issuer key!\n"));
986 }
987 return;
988}
static void handle_verify_result(void *cls, unsigned int d_count, struct GNUNET_ABD_Delegation *dc, unsigned int c_count, struct GNUNET_ABD_Delegate *dele)
Definition: gnunet-abd.c:318
static int create_ss
Create mode.
Definition: gnunet-abd.c:143
static int create_is
Create mode.
Definition: gnunet-abd.c:138
static void identity_cb(void *cls, struct GNUNET_IDENTITY_Ego *ego)
Callback invoked from identity service with ego information.
Definition: gnunet-abd.c:383
static char * subject_delegate
Subject delegate string.
Definition: gnunet-abd.c:92
static void do_timeout(void *cls)
Task run on timeout.
Definition: gnunet-abd.c:261
static void sign_cb(void *cls, struct GNUNET_IDENTITY_Ego *ego)
Definition: gnunet-abd.c:670
static int sign_ss
Create mode.
Definition: gnunet-abd.c:148
static void store_cb(void *cls, struct GNUNET_IDENTITY_Ego *ego)
Definition: gnunet-abd.c:545
static void do_shutdown(void *cls)
Task run on shutdown.
Definition: gnunet-abd.c:220
static int backward
Search direction: backward.
Definition: gnunet-abd.c:168
static int verify
Verify mode.
Definition: gnunet-abd.c:128
static int forward
Search direction: forward.
Definition: gnunet-abd.c:163
static struct GNUNET_TIME_Relative timeout
Desired timeout for the lookup (default is no timeout).
Definition: gnunet-abd.c:62
struct GNUNET_ABD_Handle * GNUNET_ABD_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Initialize the connection with the ABD service.
Definition: abd_api.c:354
struct GNUNET_ABD_Request * GNUNET_ABD_verify(struct GNUNET_ABD_Handle *handle, const struct GNUNET_CRYPTO_PublicKey *issuer_key, const char *issuer_attribute, const struct GNUNET_CRYPTO_PublicKey *subject_key, uint32_t delegate_count, const struct GNUNET_ABD_Delegate *delegates, enum GNUNET_ABD_AlgoDirectionFlags direction, GNUNET_ABD_CredentialResultProcessor proc, void *proc_cls, GNUNET_ABD_IntermediateResultProcessor proc2, void *proc2_cls)
Performs attribute verification.
Definition: abd_api.c:497
@ GNUNET_ABD_FLAG_BACKWARD
@ GNUNET_ABD_FLAG_FORWARD
#define GNUNET_GNS_EMPTY_LABEL_AT
String we use to indicate an empty label (top-level entry in the zone).
struct GNUNET_IDENTITY_EgoLookup * GNUNET_IDENTITY_ego_lookup(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, GNUNET_IDENTITY_EgoCallback cb, void *cb_cls)
Lookup an ego by name.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_free_nz(ptr)
Wrapper around free.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received,...
Definition: scheduler.c:1340
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1278
#define GNUNET_GNSRECORD_TYPE_ATTRIBUTE
For ABD reverse lookups.
const char * issuer_attribute
The issuer attribute.

References _, abd, backward, cfg, collect, create_is, create_ss, direction, do_shutdown(), do_timeout(), ego_name, el, forward, GNUNET_ABD_connect(), GNUNET_ABD_delegate_from_string(), GNUNET_ABD_FLAG_BACKWARD, GNUNET_ABD_FLAG_FORWARD, GNUNET_ABD_verify(), GNUNET_CRYPTO_public_key_from_string(), GNUNET_free, GNUNET_free_nz, GNUNET_GNS_EMPTY_LABEL_AT, GNUNET_GNSRECORD_TYPE_ATTRIBUTE, GNUNET_GNSRECORD_TYPE_DELEGATE, GNUNET_IDENTITY_ego_lookup(), GNUNET_malloc, GNUNET_memcpy, GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), GNUNET_strdup, GNUNET_YES, handle_intermediate_result(), handle_verify_result(), identity_cb(), issuer_attr, GNUNET_ABD_Delegate::issuer_attribute, issuer_key, issuer_pkey, record_label, sign_cb(), sign_ss, store_cb(), subject, subject_delegate, subject_pkey, timeout, tt, type, verify, and verify_request.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char *const *  argv 
)

The main function for gnunet-gns.

Parameters
argcnumber of arguments from the command line
argvcommand line arguments
Returns
0 ok, 1 on error

Definition at line 999 of file gnunet-abd.c.

1000{
1003 "verify",
1004 gettext_noop (
1005 "verify credential against attribute"),
1006 &verify),
1008 's',
1009 "subject",
1010 "PKEY",
1011 gettext_noop (
1012 "The public key of the subject to lookup the"
1013 "credential for, or for issuer side storage: subject and its attributes"),
1014 &subject),
1016 'd',
1017 "delegate",
1018 "DELE",
1019 gettext_noop ("The private, signed delegate presented by the subject"),
1022 'i',
1023 "issuer",
1024 "PKEY",
1025 gettext_noop (
1026 "The public key of the authority to verify the credential against"),
1027 &issuer_key),
1029 "ego",
1030 "EGO",
1031 gettext_noop ("The ego/zone name to use"),
1032 &ego_name),
1034 'a',
1035 "attribute",
1036 "ATTR",
1037 gettext_noop ("The issuer attribute to verify against or to issue"),
1038 &issuer_attr),
1040 "ttl",
1041 "EXP",
1042 gettext_noop (
1043 "The time to live for the credential."
1044 "e.g. 5m, 6h, \"1990-12-30 12:00:00\""),
1045 &expiration),
1047 "collect",
1048 gettext_noop ("collect credentials"),
1049 &collect),
1051 "createIssuerSide",
1052 gettext_noop (
1053 "Create and issue a credential issuer side."),
1054 &create_is),
1056 "createSubjectSide",
1057 gettext_noop (
1058 "Issue a credential subject side."),
1059 &create_ss),
1061 'S',
1062 "signSubjectSide",
1063 gettext_noop ("Create, sign and return a credential subject side."),
1064 &sign_ss),
1066 'x',
1067 "import",
1068 "IMP",
1069 gettext_noop (
1070 "Import signed credentials that should be issued to a zone/ego"),
1071 &import),
1073 "private",
1074 gettext_noop ("Create private record entry."),
1075 &is_private),
1077 'F',
1078 "forward",
1079 gettext_noop (
1080 "Indicates that the collect/verify process is done via forward search."),
1081 &forward),
1083 'B',
1084 "backward",
1085 gettext_noop (
1086 "Indicates that the collect/verify process is done via forward search."),
1087 &backward),
1089
1090
1092 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
1093 return 2;
1094
1095 GNUNET_log_setup ("gnunet-abd", "WARNING", NULL);
1096 if (GNUNET_OK != GNUNET_PROGRAM_run (argc,
1097 argv,
1098 "gnunet-abd",
1099 _ ("GNUnet abd resolver tool"),
1100 options,
1101 &run,
1102 NULL))
1103 ret = 1;
1104 GNUNET_free_nz ((void *) argv);
1105 return ret;
1106}
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
Definition: 002.c:13
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
#define gettext_noop(String)
Definition: gettext.h:74
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c)
Main function that will be run.
Definition: gnunet-abd.c:758
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_flag(char shortName, const char *name, const char *description, int *val)
Allow user to specify a flag (which internally means setting an integer to 1/GNUNET_YES/GNUNET_OK.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_string(char shortName, const char *name, const char *argumentHelp, const char *description, char **str)
Allow user to specify a string.
enum GNUNET_GenericReturnValue GNUNET_log_setup(const char *comp, const char *loglevel, const char *logfile)
Setup logging.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls)
Run a standard GNUnet command startup sequence (initialize loggers and configuration,...
Definition: program.c:400
enum GNUNET_GenericReturnValue GNUNET_STRINGS_get_utf8_args(int argc, char *const *argv, int *u8argc, char *const **u8argv)
Returns utf-8 encoded arguments.
Definition: strings.c:1230
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
Definition of a command line option.

References _, backward, collect, create_is, create_ss, ego_name, expiration, forward, gettext_noop, GNUNET_free_nz, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_GETOPT_option_string(), GNUNET_log_setup(), GNUNET_OK, GNUNET_PROGRAM_run(), GNUNET_STRINGS_get_utf8_args(), GNUNET_TIME_UNIT_FOREVER_REL, is_private, issuer_attr, issuer_key, options, ret, run(), sign_ss, subject, subject_delegate, timeout, and verify.

Here is the call graph for this function:

Variable Documentation

◆ cfg

const struct GNUNET_CONFIGURATION_Handle* cfg
static

Configuration we are using.

Definition at line 37 of file gnunet-abd.c.

Referenced by run(), and store_cb().

◆ ns

struct GNUNET_NAMESTORE_Handle* ns
static

Handle to the namestore.

Definition at line 42 of file gnunet-abd.c.

Referenced by do_shutdown(), get_existing_record(), and store_cb().

◆ zone_pkey

struct GNUNET_CRYPTO_PrivateKey zone_pkey
static

Private key for the our zone.

Definition at line 47 of file gnunet-abd.c.

Referenced by get_existing_record(), and store_cb().

◆ el

struct GNUNET_IDENTITY_EgoLookup* el
static

EgoLookup.

Definition at line 52 of file gnunet-abd.c.

Referenced by do_shutdown(), identity_cb(), run(), sign_cb(), and store_cb().

◆ abd

struct GNUNET_ABD_Handle* abd
static

Handle to Credential service.

Definition at line 57 of file gnunet-abd.c.

Referenced by do_shutdown(), identity_cb(), and run().

◆ timeout

struct GNUNET_TIME_Relative timeout
static

Desired timeout for the lookup (default is no timeout).

Definition at line 62 of file gnunet-abd.c.

Referenced by main(), and run().

◆ verify_request

struct GNUNET_ABD_Request* verify_request
static

Handle to verify request.

Definition at line 67 of file gnunet-abd.c.

Referenced by do_shutdown(), handle_collect_result(), handle_verify_result(), and run().

◆ collect_request

struct GNUNET_ABD_Request* collect_request
static

Handle to collect request.

Definition at line 72 of file gnunet-abd.c.

Referenced by identity_cb().

◆ tt

struct GNUNET_SCHEDULER_Task* tt
static

Task scheduled to handle timeout.

Definition at line 77 of file gnunet-abd.c.

Referenced by do_shutdown(), do_timeout(), and run().

◆ ret

int ret = 0
static

Return value of the commandline.

Definition at line 82 of file gnunet-abd.c.

Referenced by handle_verify_result(), and main().

◆ subject

char* subject
static

◆ subject_delegate

char* subject_delegate
static

Subject delegate string.

Definition at line 92 of file gnunet-abd.c.

Referenced by main(), and run().

◆ expiration

char* expiration
static

Credential TTL.

Definition at line 97 of file gnunet-abd.c.

Referenced by main(), sign_cb(), and store_cb().

◆ subject_pkey

◆ issuer_pkey

struct GNUNET_CRYPTO_PublicKey issuer_pkey

Issuer key.

Definition at line 107 of file gnunet-abd.c.

Referenced by GNUNET_ABD_delegate_from_string(), GNUNET_ABD_delegate_to_string(), identity_cb(), and run().

◆ issuer_key

char* issuer_key
static

Issuer pubkey string.

Definition at line 113 of file gnunet-abd.c.

Referenced by GNUNET_ABD_collect(), GNUNET_ABD_verify(), handle_verify_result(), identity_cb(), main(), and run().

◆ ego_name

char* ego_name
static

ego

Definition at line 118 of file gnunet-abd.c.

Referenced by identity_cb(), main(), run(), and sign_cb().

◆ issuer_attr

char* issuer_attr
static

Issuer attribute.

Definition at line 123 of file gnunet-abd.c.

Referenced by identity_cb(), main(), run(), and sign_cb().

◆ verify

int verify
static

Verify mode.

Definition at line 128 of file gnunet-abd.c.

Referenced by check_ssl_certificate(), get_store_peer_of(), main(), run(), and verify_store_peer().

◆ collect

int collect
static

Collect mode.

Definition at line 133 of file gnunet-abd.c.

Referenced by identity_cb(), main(), and run().

◆ create_is

int create_is
static

Create mode.

Definition at line 138 of file gnunet-abd.c.

Referenced by main(), and run().

◆ create_ss

int create_ss
static

Create mode.

Definition at line 143 of file gnunet-abd.c.

Referenced by main(), and run().

◆ sign_ss

int sign_ss
static

Create mode.

Definition at line 148 of file gnunet-abd.c.

Referenced by main(), and run().

◆ import

char* import
static

Signed issue credentials.

Definition at line 153 of file gnunet-abd.c.

◆ is_private

int is_private
static

Is record private.

Definition at line 158 of file gnunet-abd.c.

Referenced by get_existing_record(), and main().

◆ forward

int forward
static

Search direction: forward.

Definition at line 163 of file gnunet-abd.c.

Referenced by main(), request_room_message_step(), and run().

◆ backward

int backward
static

Search direction: backward.

Definition at line 168 of file gnunet-abd.c.

Referenced by main(), and run().

◆ direction

enum GNUNET_ABD_AlgoDirectionFlags direction = 0

API enum, filled and passed for collect/verify.

Definition at line 173 of file gnunet-abd.c.

Referenced by check_get(), GNUNET_ABD_collect(), GNUNET_ABD_verify(), handle_get(), identity_cb(), and run().

◆ add_qe

struct GNUNET_NAMESTORE_QueueEntry* add_qe
static

Queue entry for the 'add' operation.

Definition at line 178 of file gnunet-abd.c.

Referenced by do_shutdown(), get_existing_record(), and store_cb().

◆ data

void* data
static

Value in binary format.

Definition at line 183 of file gnunet-abd.c.

Referenced by get_existing_record(), and store_cb().

◆ data_size

size_t data_size
static

Number of bytes in data.

Definition at line 188 of file gnunet-abd.c.

Referenced by get_existing_record(), and store_cb().

◆ type

uint32_t type
static

Type string converted to DNS type value.

Definition at line 193 of file gnunet-abd.c.

Referenced by get_existing_record(), run(), and store_cb().

◆ typestring

char* typestring
static

Type of the record to add/remove, NULL to remove all.

Definition at line 198 of file gnunet-abd.c.

Referenced by store_cb().

◆ etime

uint64_t etime
static

Expiration string converted to numeric value.

Definition at line 202 of file gnunet-abd.c.

Referenced by get_existing_record(), parse_expiration(), and store_cb().

◆ etime_is_rel

int etime_is_rel = GNUNET_SYSERR
static

Is expiration time relative or absolute time?

Definition at line 207 of file gnunet-abd.c.

Referenced by get_existing_record(), parse_expiration(), and store_cb().

◆ record_label

char* record_label
static

Record label for storing delegations.

Definition at line 212 of file gnunet-abd.c.

Referenced by run(), and store_cb().