Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/libsvn_subr/gpg_agent.c view on Meta::CPAN
/*
* gpg_agent.c: GPG Agent provider for SVN_AUTH_CRED_*
*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
/* ==================================================================== */
/* This auth provider stores a plaintext password in memory managed by
* a running gpg-agent. In contrast to other password store providers
* it does not save the password to disk.
*
* Prompting is performed by the gpg-agent using a "pinentry" program
* which needs to be installed separately. There are several pinentry
* implementations with different front-ends (e.g. qt, gtk, ncurses).
*
* The gpg-agent will let the password time out after a while,
* or immediately when it receives the SIGHUP signal.
* When the password has timed out it will automatically prompt the
* user for the password again. This is transparent to Subversion.
*
* SECURITY CONSIDERATIONS:
*
* Communication to the agent happens over a UNIX socket, which is located
* in a directory which only the user running Subversion can access.
* However, any program the user runs could access this socket and get
* the Subversion password if the program knows the "cache ID" Subversion
* uses for the password.
* The cache ID is very easy to obtain for programs running as the same user.
* Subversion uses the MD5 of the realmstring as cache ID, and these checksums
* are also used as filenames within ~/.subversion/auth/svn.simple.
* Unlike GNOME Keyring or KDE Wallet, the user is not prompted for
* permission if another program attempts to access the password.
*
* Therefore, while the gpg-agent is running and has the password cached,
* this provider is no more secure than a file storing the password in
* plaintext.
*/
/*** Includes. ***/
#ifndef WIN32
#include <unistd.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <apr_pools.h>
#include "svn_auth.h"
#include "svn_config.h"
#include "svn_error.h"
#include "svn_pools.h"
#include "svn_cmdline.h"
#include "svn_checksum.h"
#include "svn_string.h"
#include "svn_hash.h"
#include "svn_user.h"
#include "svn_dirent_uri.h"
#include "private/svn_auth_private.h"
#include "svn_private_config.h"
#ifdef SVN_HAVE_GPG_AGENT
#define BUFFER_SIZE 1024
#define ATTEMPT_PARAMETER "svn.simple.gpg_agent.attempt"
/* Modify STR in-place such that blanks are escaped as required by the
* gpg-agent protocol. Return a pointer to STR. */
static char *
escape_blanks(char *str)
{
char *s = str;
while (*s)
{
if (*s == ' ')
( run in 0.585 second using v1.01-cache-2.11-cpan-39bf76dae61 )