200
197
new_packet_length += ret;
203
/* FIXME: check characters before printing to screen so to not print
204
terminal control characters */
206
/* fprintf(stderr, "decrypted password is: "); */
207
/* fwrite(*new_packet, 1, new_packet_length, stderr); */
208
/* fprintf(stderr, "\n"); */
211
/* Delete the GPGME plaintext data buffer */
201
fprintf(stderr, "decrypted password is: %s\n", *new_packet);
204
/* Delete the GPGME plaintext data buffer */
212
205
gpgme_data_release(dh_plain);
213
206
return new_packet_length;
319
312
void empty_log(AvahiLogLevel level, const char *txt){}
321
int start_mandos_communication(char *ip, uint16_t port){
314
int start_mandos_communcation(char *ip, uint16_t port){
323
316
struct sockaddr_in6 to;
324
317
encrypted_session es;
328
321
size_t buffer_capacity = 0;
329
322
ssize_t decrypted_buffer_size;
324
const char interface[] = "eth0";
333
327
fprintf(stderr, "Setting up a tcp connection to %s\n", ip);
501
495
fprintf(stderr, "Mandos server found at %s on port %d\n", ip, port);
503
int ret = start_mandos_communication(ip, port);
497
int ret = start_mandos_communcation(ip, port);
505
499
exit(EXIT_SUCCESS);
558
552
int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char*argv[]) {
559
553
AvahiServerConfig config;
560
554
AvahiSServiceBrowser *sb = NULL;
555
const char db[] = "--debug";
563
558
int returncode = EXIT_SUCCESS;
566
static struct option long_options[] = {
567
{"debug", no_argument, (int *)&debug, 1},
568
{"interface", required_argument, 0, 'i'},
571
int option_index = 0;
572
ret = getopt_long (argc, argv, "i:", long_options, &option_index);
559
char *basename = rindex(argv[0], '/');
560
if(basename == NULL){
566
char *program_name = malloc(strlen(basename) + sizeof(db));
568
if (program_name == NULL){
573
program_name[0] = '\0';
575
for (int i = 1; i < argc; i++){
576
if (not strncmp(argv[i], db, 5)){
577
strcat(strcat(strcat(program_name, db ), "="), basename);
578
if(not strcmp(argv[i], db) or not strcmp(argv[i], program_name)){
590
586
avahi_set_log_function(empty_log);