aboutsummaryrefslogtreecommitdiffstats
path: root/common/sysutils.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Change all http://www.gnu.org in license notices to https://Werner Koch2016-11-051-1/+1
| | | | --
* common: New function gnupg_usleep.Werner Koch2016-10-311-1/+45
| | | | | | | | | | | * configure.ac (HAVE_NANOSLEEP): Test for nanosleep. * common/sysutils.c: Always include time.h. (gnupg_usleep): New. -- This function has been compiled from nPth and Libassuan. Signed-off-by: Werner Koch <[email protected]>
* common: Remove debug output from gnupg_get_socket_name.Werner Koch2016-10-271-4/+4
| | | | | | | * common/sysutils.c (gnupg_get_socket_name): Remove debug message and use my_error_from_syserror. Signed-off-by: Werner Koch <[email protected]>
* common: Fix gnupg_inotify_has_name, differently.NIIBE Yutaka2016-10-271-21/+15
| | | | | | | | | | | * common/sysutils.c (gnupg_inotify_has_name): Use void * to stop the warning. -- According to the man page of inotify(7), it is aligned by null bytes. So, bc28f320fa6f5b9fcdb73dba5e6c582daf7992c5 is reverted. Signed-off-by: NIIBE Yutaka <[email protected]>
* agent,common: move get_socket_name() into common.Daniel Kahn Gillmor2016-10-271-0/+49
| | | | | | | | | | * agent/gpg-agent.c (get_socket_name): move to ... * common/sysutils.c (gnupg_get_socket_name): ... here. -- This allows us to use the same functionality in dirmngr as well. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* common: Fix gnupg_inotify_has_name.NIIBE Yutaka2016-10-271-14/+22
| | | | | | | | | * common/sysutils.c (gnupg_inotify_has_name): Take care of the alignment. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* common: Use GPG_ERR_INV_VALUE instead of GPG_ERR_EINVAL.Werner Koch2016-10-261-1/+1
| | | | | | | | | | | | * common/sysutils.c (gnupg_inotify_watch_socket): Return GPG_ERR_INV_VALUE for a missing socket name and set proper error source. -- By using a different value we can easier see whether the error is due to a system call or from GnuPG code. Signed-off-by: Werner Koch <[email protected]>
* common: avoid segfaultDaniel Kahn Gillmor2016-10-261-0/+3
| | | | | | | * common/sysutils.c (gnupg_inotify_watch_socket): return EINVAL if socket_name is NULL, rather than segfaulting -- Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* common: Use strconcat in gnupg_setenv.Werner Koch2016-10-251-22/+22
| | | | | | | | * common/sysutils.c (gnupg_setenv): Replace malloc+stpcpy by strconcat. Indent cpp conditionals. (gnupg_unsetenv): Indent cpp conditionals. Signed-off-by: Werner Koch <[email protected]>
* common,w32: Fix setting environment variables on Windows.Justus Winter2016-10-201-39/+62
| | | | | | | | | * common/sysutils.c (gnupg_setenv): Also update the environment block maintained by the C runtime. (gnupg_unsetenv): Likewise. * tests/gpgscm/ffi.c (do_setenv): Fix error handling. Signed-off-by: Justus Winter <[email protected]>
* agent: Move inotify code to common and improve it.Werner Koch2016-10-151-0/+127
| | | | | | | | | | | | | | | | | | | | | | | * common/sysutils.c: Include sys/inotify.h. (my_error_from_syserror, my_error): New. (gnupg_inotify_watch_socket): New. (gnupg_inotify_has_name): New. * agent/gpg-agent.c: Do not include sys/inotify.h. (my_inotify_is_name): Remove. (handle_connections): Remove HAVE_INOTIFY_INIT protected code and use the new functions. -- When removing not a simple socket file but the entire directory the old code missed most events and thus did not worked properly. IN_DELETE_SELF has also been added to the watch list to detect a removal of the directory. However, in all tests that event was not triggered. The only way it could be triggered was by not watching the socket dir but an arbitary directory and rmdir that. GnuPG-bug-id: 2756 Signed-off-by: Werner Koch <[email protected]>
* Explicitly restrict socket permissions.Werner Koch2016-06-081-1/+1
| | | | | | | | | | * agent/gpg-agent.c (create_server_socket): Call chmod before listen. * scd/scdaemon.c (create_server_socket): Ditto. * dirmngr/dirmngr.c (main): Ditto. -- This is just in case of a improperly set umask. Note that a connect requires a write permissions.
* common,w32: Silence an unused arg warning message.Werner Koch2016-05-241-0/+2
| | | | --
* agent: Sanitize permissions of the private key directory.Justus Winter2016-04-201-24/+49
| | | | | | | | | | | | | * agent/gpg-agent.c (create_private_keys_directory): Set permissions. * common/sysutils.c (modestr_to_mode): New function. (gnupg_mkdir): Use new function. (gnupg_chmod): New function. * common/sysutils.h (gnupg_chmod): New prototype. * tests/migrations/from-classic.test: Test migration with existing directory. GnuPG-bug-id: 2312 Signed-off-by: Justus Winter <[email protected]>
* Fix typos found using codespell.Justus Winter2015-11-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * agent/cache.c: Fix typos. * agent/call-pinentry.c: Likewise. * agent/call-scd.c: Likewise. * agent/command-ssh.c: Likewise. * agent/command.c: Likewise. * agent/divert-scd.c: Likewise. * agent/findkey.c: Likewise. * agent/gpg-agent.c: Likewise. * agent/w32main.c: Likewise. * common/argparse.c: Likewise. * common/audit.c: Likewise. * common/audit.h: Likewise. * common/convert.c: Likewise. * common/dotlock.c: Likewise. * common/exechelp-posix.c: Likewise. * common/exechelp-w32.c: Likewise. * common/exechelp-w32ce.c: Likewise. * common/exechelp.h: Likewise. * common/helpfile.c: Likewise. * common/i18n.h: Likewise. * common/iobuf.c: Likewise. * common/iobuf.h: Likewise. * common/localename.c: Likewise. * common/logging.c: Likewise. * common/openpgp-oid.c: Likewise. * common/session-env.c: Likewise. * common/sexputil.c: Likewise. * common/sysutils.c: Likewise. * common/t-sexputil.c: Likewise. * common/ttyio.c: Likewise. * common/util.h: Likewise. * dirmngr/cdblib.c: Likewise. * dirmngr/certcache.c: Likewise. * dirmngr/crlcache.c: Likewise. * dirmngr/dirmngr-client.c: Likewise. * dirmngr/dirmngr.c: Likewise. * dirmngr/dirmngr_ldap.c: Likewise. * dirmngr/dns-stuff.c: Likewise. * dirmngr/http.c: Likewise. * dirmngr/ks-engine-hkp.c: Likewise. * dirmngr/ks-engine-ldap.c: Likewise. * dirmngr/ldap-wrapper.c: Likewise. * dirmngr/ldap.c: Likewise. * dirmngr/misc.c: Likewise. * dirmngr/ocsp.c: Likewise. * dirmngr/validate.c: Likewise. * g10/encrypt.c: Likewise. * g10/getkey.c: Likewise. * g10/gpg.c: Likewise. * g10/gpgv.c: Likewise. * g10/import.c: Likewise. * g10/keydb.c: Likewise. * g10/keydb.h: Likewise. * g10/keygen.c: Likewise. * g10/keyid.c: Likewise. * g10/keylist.c: Likewise. * g10/keyring.c: Likewise. * g10/mainproc.c: Likewise. * g10/misc.c: Likewise. * g10/options.h: Likewise. * g10/packet.h: Likewise. * g10/parse-packet.c: Likewise. * g10/pkclist.c: Likewise. * g10/pkglue.c: Likewise. * g10/plaintext.c: Likewise. * g10/server.c: Likewise. * g10/sig-check.c: Likewise. * g10/sqlite.c: Likewise. * g10/tdbio.c: Likewise. * g10/test-stubs.c: Likewise. * g10/tofu.c: Likewise. * g10/trust.c: Likewise. * g10/trustdb.c: Likewise. * g13/create.c: Likewise. * g13/mountinfo.c: Likewise. * kbx/keybox-blob.c: Likewise. * kbx/keybox-file.c: Likewise. * kbx/keybox-init.c: Likewise. * kbx/keybox-search-desc.h: Likewise. * kbx/keybox-search.c: Likewise. * kbx/keybox-update.c: Likewise. * scd/apdu.c: Likewise. * scd/app-openpgp.c: Likewise. * scd/app-p15.c: Likewise. * scd/app.c: Likewise. * scd/ccid-driver.c: Likewise. * scd/command.c: Likewise. * scd/iso7816.c: Likewise. * sm/base64.c: Likewise. * sm/call-agent.c: Likewise. * sm/call-dirmngr.c: Likewise. * sm/certchain.c: Likewise. * sm/gpgsm.c: Likewise. * sm/import.c: Likewise. * sm/keydb.c: Likewise. * sm/minip12.c: Likewise. * sm/qualified.c: Likewise. * sm/server.c: Likewise. * tools/gpg-check-pattern.c: Likewise. * tools/gpgconf-comp.c: Likewise. * tools/gpgkey2ssh.c: Likewise. * tools/gpgparsemail.c: Likewise. * tools/gpgtar.c: Likewise. * tools/rfc822parse.c: Likewise. * tools/symcryptrun.c: Likewise. Signed-off-by: Justus Winter <[email protected]>
* Remove use of gnulib (part 2)Werner Koch2014-11-111-9/+143
| | | | | | | | | | | | | | | | * configure.ac (strpbrk): Add to AC_CHECK_FUNCS. (gl_EARLY): Remove. * common/stringhelp.c (strpbrk) [!HAVE_STRPBRK]: New. * common/sysutils.c (gnupg_mkdtemp): New. Based on code from glibc-2.6. (gnupg_setenv): Rewrite. (gnupg_unsetenv): Rewrite. * g10/exec.c: Include sysutils.h and replace mkdtemp by gnupg_mkdtemp. * g13/be-encfs.c: Ditto. * g13/mount.c: Ditto. * tools/symcryptrun.c (confucius_mktmpdir): Ditto. Signed-off-by: Werner Koch <[email protected]>
* Remove use of gnulib (part 1)Werner Koch2014-11-111-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * gl/: Remove entire tree. * configure.ac: Remove gnulib tests and the gl/ Makefile. (setenv): Add to AC_CHECK_FUNCS. * autogen.rc (extra_aclocal_flags): Set to empty. * Makefile.am (ACLOCAL_AMFLAGS): Remove -I gl/m4 (SUBDIRS): Remove gl/. * agent/Makefile.am (common_libs): Remove ../gl/gnulib.a * common/Makefile.am (t_common_ldadd): Ditto. * dirmngr/Makefile.am (dirmngr_LDADD): Ditto. (dirmngr_ldap_LDADD, dirmngr_client_LDADD): Ditto. * g10/Makefile.am (needed_libs): Ditto. * g13/Makefile.am (g13_LDADD): Ditto. * kbx/Makefile.am (kbxutil_LDADD): Ditto. ($(PROGRAMS)): Ditto. * scd/Makefile.am (scdaemon_LDADD): Ditto. * sm/Makefile.am (common_libs): Ditto. * tools/Makefile.am (common_libs, commonpth_libs): Ditto. * agent/gpg-agent.c: Remove "mkdtemp.h" * g10/exec.c: Ditto. * scd/scdaemon.c: Ditto. * tools/symcryptrun.c: Ditto. * common/sysutils.c: Remove "setenv.h" * common/t-timestuff.c: Use putenv if setenv is not available. -- gnulib has always been a cause of trouble in GnuPG because we used only a very few functions and the complex include machinery of gnulib is quite complex and the cause for many build problems for example on OS X. This is not gnulib's fault but due to our limited use of gnulib and that we only rarely update the gnulib code to avoid regressions. In part two we will address the functions mkdtemp setenv unsetenv strpbrk which may bot be implemented on all platforms. They are not required on a libc based system. Signed-off-by: Werner Koch <[email protected]>
* common: Cleanup the use of USE_NPTH and HAVE_NPTH macros.Werner Koch2014-05-021-12/+2
| | | | | | | | | | | | | | | | | * configure.ac (HAVE_NPTH): New ac_define. * common/estream.c: Use USE_NPTH instead of HAVE_NPTH. * common/http.c: Ditto. Replace remaining calls to pth by npth calls. (connect_server): Remove useless _(). * common/exechelp-posix.c, common/exechelp-w32.c * common/exechelp-w32ce.c: Use HAVE_PTH to include npth.h. * common/init.c (_init_common_subsystems): Remove call to pth_init. * common/sysutils.c (gnupg_sleep): Use npth_sleep. * scd/ccid-driver.c (my_sleep): Ditto. -- USE_NPTH is used in case were we may build with and without nPth. The missing definition HAVE_NPTH didn't allowed us to build outher sources with nPTh support.
* common: Add function gnupg_getcwd.Werner Koch2014-04-221-0/+30
| | | | | | * tools/gpg-connect-agent.c (gnu_getcwd): Move to ... * common/sysutils.c (gnupg_getcwd): .. here. * tools/gpg-connect-agent.c (get_var_ext): Use gnupg_getcwd.
* w32: Include winsock2.h to silence warnings.Werner Koch2014-03-071-0/+3
|
* w32: Define WINVER only if needed.Werner Koch2014-03-071-1/+3
| | | | * common/sysutils.c (WINVER): Define only if less that 5.0.
* ssh: Add support for Putty.Werner Koch2014-03-071-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * agent/gpg-agent.c [W32]: Include Several Windows header. (opts): Change help text for enable-ssh-support. (opts, main): Add option --enable-putty-support (putty_support, PUTTY_IPC_MAGIC, PUTTY_IPC_MAXLEN): New for W32. (agent_init_default_ctrl): Add and asssert call. (putty_message_proc, putty_message_thread): New. (handle_connections) [W32]: Start putty message thread. * common/sysutils.c (w32_get_user_sid): New for W32 only * tools/gpgconf-comp.c (gc_options_gpg_agent): Add --enable-ssh-support and --enable-putty-support. Make the configuration group visible at basic level. * agent/command-ssh.c (serve_mmapped_ssh_request): New for W32 only. -- This patch enables support for Putty. It has been tested with Putty 0.62 using an Unix created ssh key copied to the private-keys-v1.d directory on Windows and with a manually crafted sshcontrol file. It also works with a smartcard key. May thanks to gniibe who implemented a proxy in Python to test the putty/gpg-agent communication. Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit 9f32499f99a0817f63f7a73b09bdcebe60d4775d) Resolved conflicts: NEWS agent/agent.h agent/gpg-agent.c: Convert from pth to npth. common/sysutils.c common/sysutils.h
* Change license for some files in common to LGPLv3+/GPLv2+.Werner Koch2012-04-201-5/+15
| | | | | | | | | | | | | | | | | | | | | | | Having the LGPL on the common GnuPG code helps to share code between GnuPG and related projects (like GPGME and Libassuan). This is good for interoperability and to reduces bugs. * common/asshelp.c, common/asshelp.h, common/asshelp2.c, common/b64dec.c * common/b64enc.c, common/convert.c, common/dns-cert.c * common/dns-cert.h common/exechelp-posix.c, common/exechelp-w32.c * common/exechelp-w32ce.c, common/exechelp.h, common/get-passphrase.c * common/get-passphrase.h, common/gettime.c, common/gpgrlhelp.c * common/helpfile.c, common/homedir.c, common/http.c, common/http.h * common/i18n.c, common/init.c, common/init.h, common/iobuf.c * common/iobuf.h, common/localename.c, common/membuf.c, common/membuf.h * common/miscellaneous.c, common/openpgp-oid.c, common/openpgpdefs.h * common/percent.c, common/pka.c, common/pka.h, common/session-env.c * common/session-env.h, common/sexp-parse.h, common/sexputil.c * common/signal.c, common/srv.c, common/srv.h, common/ssh-utils.c * common/ssh-utils.h, common/sysutils.c, common/sysutils.h * common/tlv.c, common/tlv.h, common/ttyio.c, common/ttyio.h * common/userids.c, common/userids.h, common/xasprintf.c: Change license to LGPLv3+/GPLv2+/
* Port to npth.Marcus Brinkmann2012-01-251-6/+6
| | | | | | | | | | | | | | | | | | | | | * configure.ac: Don't check for PTH but for NPTH. (AH_BOTTOM): Remove PTH_SYSCALL_SOFT. (have_pth): Rename to ... (have_npth): ... this. (USE_GNU_NPTH): Rename to ... (USE_GNU_PTH): ... this. * m4/npth.m4: New file. * agent/Makefile.am, agent/cache.c, agent/call-pinentry.c, agent/call-scd.c, agent/findkey.c, agent/gpg-agent.c, agent/trustlist.c, common/Makefile.am, common/estream.c, common/exechelp-posix.c, common/exechelp-w32.c, common/exechelp-w32ce.c, common/http.c, common/init.c, common/sysutils.c, dirmngr/Makefile.am, dirmngr/crlfetch.c, dirmngr/dirmngr.c, dirmngr/dirmngr_ldap.c, dirmngr/ldap-wrapper-ce.c, dirmngr/ldap-wrapper.c, dirmngr/ldap.c, g13/Makefile.am, g13/call-gpg.c, g13/g13.c, g13/runner.c, scd/Makefile.am, scd/apdu.c, scd/app.c, scd/ccid-driver.c, scd/command.c, scd/scdaemon.c, tools/Makefile.am: Port to npth.
* Add code for explicit selection of pooled A records.Werner Koch2011-04-121-0/+11
| | | | | | | | | | | To better cope with round robin pooled A records like keys.gnupg.net we need to keep some information on unresponsive hosts etc. What we do now is to resolve the hostnames, remember them and select a random one. If a host is dead it will be marked and a different one selected. This is intended to solve the problem of long timeouts due to unresponsive hosts. The code is not yet finished but selection works.
* Nuked almost all trailing white space.post-nuke-of-trailing-wsWerner Koch2011-02-041-15/+14
| | | | | | | | We better do this once and for all instead of cluttering all future commits with diffs of trailing white spaces. In the majority of cases blank or single lines are affected and thus this change won't disturb a git blame too much. For future commits the pre-commit scripts checks that this won't happen again.
* Fix dirmngr problems on CE.Werner Koch2010-08-121-2/+2
| | | | | | Add new dirmngr commands. Minor other fixes.
* common/Marcus Brinkmann2010-06-101-2/+4
| | | | | | | | | | | | | 2010-06-11 Marcus Brinkmann <[email protected]> * sysutils.c (translate_sys2libc_fd): Revert last change. (translate_sys2libc_fd_int): Revert last change. sm/ 2010-06-11 Marcus Brinkmann <[email protected]> * server.c (cmd_message) [HAVE_W32CE_SYSTEM]: Finish pipe.
* 2010-06-10 Marcus Brinkmann <[email protected]>Marcus Brinkmann2010-06-101-4/+2
| | | | | | | | * sysutils.c (translate_sys2libc_fd) [HAVE_W32CE_SYSTEM]: Implement. (translate_sys2libc_fd_int) [HAVE_W32CE_SYSTEM]: Don't call translate_sys2libc_fd.
* 2010-06-08 Marcus Brinkmann <[email protected]>Marcus Brinkmann2010-06-081-1/+3
| | | | | | | | | | * Makefile.am (AM_CFLAGS): Add $(LIBASSUAN_CFLAGS). (t_common_ldadd): Add $(LIBASSUAN_LIBS). * sysutils.c: Include <assuan.h>. (translate_sys2libc_fd_int): Cast to silence gcc warning. * iobuf.c: Include <assuan.h> (translate_file_handle): Fix syntax error.
* Change OpenPGP test framework to run under the control of the agent.Werner Koch2010-06-071-2/+7
|
* common/Marcus Brinkmann2010-04-201-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 2010-04-20 Marcus Brinkmann <[email protected]> * logging.c (do_log_ignore_arg): New helper function. (log_string): Use it to remove ugly volatile hack that causes gcc warning. (log_flush): Likewise. * sysutils.c (gnupg_unsetenv) [!HAVE_W32CE_SYSTEM]: Return something. (gnupg_setenv) [!HAVE_W32CE_SYSTEM]: Likewise. * pka.c (get_pka_info): Solve strict aliasing rule violation. * t-exechelp.c (test_close_all_fds): Use dummy variables to silence gcc warning. kbx/ 2010-04-20 Marcus Brinkmann <[email protected]> * keybox-update.c [!HAVE_DOSISH_SYSTEM]: Include ../common/sysutils.h even then to silence gcc warning about missing declaration of gnupg_remove. tools/ 2010-04-20 Marcus Brinkmann <[email protected]> * gpgconf-comp.c (option_check_validity): Use dummy variables to silence gcc warning.
* Fixed dependencies and a syntax errorWerner Koch2010-04-141-2/+2
|
* ./autogen.sh --build-w32ce does now succeed.Werner Koch2010-04-141-0/+11
|
* Whole lot of changes to support CE.Werner Koch2010-04-141-2/+109
|
* More changes for CE. gpgsm does now build and run a keylisting.Werner Koch2010-03-241-0/+24
|
* More chnages to use estream. Add a way to replace the standardWerner Koch2010-03-221-1/+1
| | | | | descriptors.
* First steps towards the W32CE portWerner Koch2010-03-021-28/+57
|
* Import/export of pkcs#12 now uses the gpg-agent directly.Werner Koch2009-04-011-3/+5
| | | | | Removed duplicated code (percent unescaping).
* Marked all unused args on non-W32 platforms.Werner Koch2008-10-201-0/+2
|
* g10/Marcus Brinkmann2008-06-251-128/+0
| | | | | | | | | | | | | | | | | | | | | | 2008-06-25 Marcus Brinkmann <[email protected]> * gpg.c (enum cmd_and_opt_values): Remove option oEnableW32HandleTranslation. (opts): Remove option --enable-w32-handle-translation. (main): Remove variable w32_handle_translation. common/ 2008-06-25 Marcus Brinkmann <[email protected]> Revert last three changes related to handle translation. * sysutils.c: (FD_TRANSLATE_MAX, fd_translate, fd_translate_len) (translate_table_init, translate_table_lookup): Removed. * iobuf.c (check_special_filename): Do not use translate_table_lookup. * sysutils.h (translate_table_init, translate_table_lookup): Remove prototypes.
* Robustness fix.Werner Koch2008-06-191-9/+16
| | | | | Add group to the --gpgconf-list.
* 2008-06-18 Marcus Brinkmann <[email protected]>Marcus Brinkmann2008-06-181-1/+4
| | | | | * sysutils.c (TRANS_MAX): Bump up to 350 to be on the safe side.
* 2008-06-18 Marcus Brinkmann <[email protected]>Marcus Brinkmann2008-06-181-0/+118
| | | | | | | | | | | | | * sysutils.h (translate_table_init, translate_table_lookup): New prototypes. * sysutils.c: Include <ctype.h>. (FD_TRANSLATE_MAX): New macro. (fd_translate, fd_translate_len): New static variables. (translate_table_init, translate_table_lookup): New functions. (translate_sys2libc_fd_int): Translate file descriptor. * iobuf.c (check_special_filename): Translate handle values from special filenames.
* Poems for AllowSetForegroundWindow (W32)Werner Koch2008-02-141-1/+16
|
* Try to make sure that the standard descriptors are connected when callingWerner Koch2007-12-031-1/+75
| | | | | gpgsm.
* Updated estream.Werner Koch2007-08-221-2/+88
| | | | | More changes for Windows.
* Translate all file descriptors received from assuan.Werner Koch2007-07-121-13/+25
|
* Changed to GPLv3.Werner Koch2007-07-041-4/+2
| | | | | Removed intl/.
* Fixed a problem in estream-printf.c.Werner Koch2007-06-251-0/+29
| | | | | Changes for Windows (gpgsm -k does now work). Minor cleanups.