Changeset 1269:bf8648506a58 in roaraudio for libroar/vio_cmd.c
- Timestamp:
- 02/27/09 12:53:53 (15 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/vio_cmd.c
r1266 r1269 374 374 } 375 375 376 int roar_vio_open_gpg(struct roar_vio_calls * calls, struct roar_vio_calls * dst, char * pw, int wronly, char * opts ) {376 int roar_vio_open_gpg(struct roar_vio_calls * calls, struct roar_vio_calls * dst, char * pw, int wronly, char * opts, int options) { 377 377 #ifdef ROAR_HAVE_BIN_GPG 378 378 char command[1024]; 379 char para[1024] = {0}; 379 380 int pwpipe[2]; 380 381 int ret; 381 382 383 /* 384 #define ROAR_VIO_PGP_OPTS_NONE 0x00 385 #define ROAR_VIO_PGP_OPTS_ASCII 0x01 386 #define ROAR_VIO_PGP_OPTS_SIGN 0x02 387 #define ROAR_VIO_PGP_OPTS_TEXTMODE 0x04 388 */ 389 390 if ( options & ROAR_VIO_PGP_OPTS_ASCII ) 391 strncat(para, "--armor ", 16); 392 393 if ( options & ROAR_VIO_PGP_OPTS_SIGN ) 394 strncat(para, "--sign ", 16); 395 396 if ( options & ROAR_VIO_PGP_OPTS_TEXTMODE ) 397 strncat(para, "--textmode ", 16); 398 382 399 if ( pw != NULL ) { 383 400 if ( pipe(pwpipe) == -1 ) 384 401 return -1; 385 402 386 snprintf(command, 1024, "%s -- no-verbose --quiet --passphrase-repeat 0 --passphrase-fd %i %s", ROAR_HAVE_BIN_GPG, pwpipe[0], opts);403 snprintf(command, 1024, "%s --batch --no-verbose --quiet --passphrase-repeat 0 --passphrase-fd %i %s %s", ROAR_HAVE_BIN_GPG, pwpipe[0], para, opts); 387 404 388 405 write(pwpipe[1], pw, strlen(pw)); … … 390 407 close(pwpipe[1]); 391 408 } else { 392 snprintf(command, 1024, "%s --no-verbose --quiet %s", ROAR_HAVE_BIN_GPG, opts);409 snprintf(command, 1024, "%s --no-verbose --quiet --batch %s %s", ROAR_HAVE_BIN_GPG, para, opts); 393 410 } 394 411 … … 409 426 410 427 int roar_vio_open_pgp_decrypt(struct roar_vio_calls * calls, struct roar_vio_calls * dst, char * pw) { 411 return roar_vio_open_gpg(calls, dst, pw, 0, "-d"); 412 } 413 428 return roar_vio_open_gpg(calls, dst, pw, 0, "-d", ROAR_VIO_PGP_OPTS_NONE); 429 } 430 431 int roar_vio_open_pgp_store(struct roar_vio_calls * calls, struct roar_vio_calls * dst, int options) { 432 return roar_vio_open_gpg(calls, dst, NULL, 1, "--store", options); 433 } 434 435 int roar_vio_open_pgp_encrypt_sym(struct roar_vio_calls * calls, struct roar_vio_calls * dst, char * pw, int options) { 436 return roar_vio_open_gpg(calls, dst, pw, 1, "--symmetric", options); 437 } 438 int roar_vio_open_pgp_encrypt_pub(struct roar_vio_calls * calls, struct roar_vio_calls * dst, char * pw, int options, char * recipient) { 439 char buf[1024]; 440 441 snprintf(buf, 1024, "-e -r %s", recipient); 442 return roar_vio_open_gpg(calls, dst, pw, 1, buf, options); 443 } 414 444 415 445 //ll
Note: See TracChangeset
for help on using the changeset viewer.