#!/bin/sh # # This is a fake wallet backend that returns bogus data for verification by # the client test suite. It doesn't test any of the wallet server code. # # Written by Russ Allbery # Copyright 2007-2008, 2010 # The Board of Trustees of the Leland Stanford Junior University # # SPDX-License-Identifier: MIT command="$1" shift type="$1" shift if [ "$type" != "keytab" ] && [ "$type" != "file" ] ; then echo "Unknown object type $type" >&2 exit 1 fi case "$command" in check) if [ -n "$2" ] ; then echo "Too many arguments" >&2 exit 1 fi case "${type}:${1}" in file:fake-test) if [ -f autocreated ] ; then echo 'yes' else echo 'no' fi ;; *) echo 'yes' ;; esac exit 0 ;; autocreate) if [ -n "$2" ] ; then echo "Too many arguments" >&2 exit 1 fi case "${type}:${1}" in file:fake-test) touch autocreated exit 0 ;; *) echo "Autocreate called for existing object" >&2 exit 1 ;; esac ;; get) if [ -n "$2" ] ; then echo "Too many arguments" >&2 exit 1 fi case "${type}:${1}" in file:fake-test) cat data/fake-data exit 0 ;; keytab:service/fake-srvtab) cat data/fake-keytab exit 0 ;; keytab:service/fake-keytab) cat data/fake-keytab-2 exit 0 ;; keytab:service/fake-output) printf 'This is a fake keytab.' exit 0 ;; *) echo "Unknown $type $1" >&2 exit 1 ;; esac ;; store) if [ -n "$3" ] ; then echo 'Too many arguments' >&2 exit 1 fi if [ -n "$2" ] ; then echo 'stdin remctld configuration not supported' >&2 exit 1 fi printf "$type $1\n" > store-output cat >> store-output ;; show) if [ -n "$2" ] ; then echo "Too many arguments" >&2 exit 1 fi if [ "$type" = "file" ] && [ "$1" = "fake-test" ] ; then echo "Some stuff about $type $1" exit 0 else echo "Unknown $type $1" >&2 exit 1 fi ;; expires) if [ -n "$2" ] ; then echo "Too many arguments" >&2 exit 1 fi echo "Expiration date of $type $1" exit 0 ;; *) echo "Unknown command $command" >&2 exit 1 ;; esac