/*
Authors:
Jan Cholasta <jcholast@redhat.com>
Copyright (C) 2012 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <talloc.h>
#include <popt.h>
#include <locale.h>
#include <libintl.h>
#include <string.h>
#include "util/crypto/sss_crypto.h"
#include "sss_client/sss_cli.h"
#include "sss_client/ssh/sss_ssh_client.h"
/* FIXME - split from tools_util to create a common function */
{
}
/* FIXME - split from tools_util to create a common function */
int set_locale(void)
{
char *c;
if (c == NULL) {
/* If setlocale fails, continue with the default
* locale. */
}
errno = 0;
if (c == NULL) {
return errno;
}
errno = 0;
c = textdomain(PACKAGE);
if (c == NULL) {
return errno;
}
return EOK;
}
/* SSH public key request:
*
* header:
* 0..3: flags (unsigned int, must be combination of SSS_SSH_REQ_* flags)
* 4..7: name length (unsigned int)
* 8..X: name (null-terminated UTF-8 string)
* alias (only included if flags & SSS_SSH_REQ_ALIAS):
* 0..3: alias length (unsigned int)
* 4..X: alias (null-terminated UTF-8 string)
* domain (ony included if flags & SSS_SSH_REQ_DOMAIN):
* 0..3: domain length (unsigned int, 0 means default domain)
* 4..X: domain (null-terminated UTF-8 string)
*
* SSH public key reply:
*
* header:
* 0..3: number of results (unsigned int)
* 4..7: reserved (unsigned int, must be 0)
* results (repeated for each result):
* 0..3: flags (unsigned int, must be 0)
* 4..7: name length (unsigned int)
* 8..(X-1): name (null-terminated UTF-8 string)
* X..(X+3): key length (unsigned int)
* (X+4)..Y: key (public key data)
*/
enum sss_cli_command command,
const char *name,
const char *domain,
const char *alias,
struct sss_ssh_ent **result)
{
size_t c = 0;
if (!tmp_ctx) {
return ENOMEM;
}
/* build request */
flags = 0;
if (alias) {
}
if (!req) {
goto done;
}
if (alias) {
}
if (domain_len > 0) {
}
/* send request */
goto done;
}
if (req_ret != SSS_STATUS_SUCCESS) {
goto done;
}
/* parse reply */
c = 0;
goto done;
}
if (reserved != 0) {
goto done;
}
if (!res) {
goto done;
}
if (count > 0) {
goto done;
}
}
for (i = 0; i < count; i++) {
goto done;
}
if (flags != 0) {
goto done;
}
goto done;
}
goto done;
}
goto done;
}
} else {
c += len;
}
goto done;
}
goto done;
}
}
done:
return ret;
}