#!/bin/sh # $Id$ # # 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 Board of Trustees, Leland Stanford Jr. University # See LICENSE for licensing terms. command="$1" shift type="$1" shift if [ "$type" != "keytab" ] ; then echo "Unknown object type $type" >&2 exit 1 fi case "$command" in getattr) if [ -n "$3" ] ; then echo "Too many arguments" >&2 exit 1 fi if [ "$2" != sync ] ; then echo "Unknown attribute $2" >&2 exit 1 fi case "$1" in service/fake-srvtab) if [ -f sync-kaserver ] ; then echo "kaserver" fi ;; *) echo "Looking at sync attribute of wrong keytab" >&2 exit 1 ;; esac ;; setattr) if [ -n "$4" ] ; then echo "Too many arguments" >&2 exit 1 fi if [ "$2" != sync ] ; then echo "Unknown attribute $2" >&2 exit 1 fi case "$1" in service/fake-srvtab) if [ "$3" != "kaserver" ] ; then echo "Invalid attribute value $3" >&2 exit 1 fi touch sync-kaserver ;; *) echo "Looking at sync attribute of wrong keytab" >&2 exit 1 ;; esac ;; get) if [ -n "$2" ] ; then echo "Too many arguments" >&2 exit 1 fi case "$1" in service/fake-test) cat data/fake-data exit 0 ;; service/fake-srvtab) cat data/fake-keytab exit 0 ;; *) echo "Unknown keytab $1" >&2 exit 1 ;; esac ;; show) if [ -n "$2" ] ; then echo "Too many arguments" >&2 exit 1 fi if [ "$1" = "service/fake-test" ] ; then echo "Some stuff about $1" exit 0 else echo "Unknown keytab $1" >&2 exit 1 fi ;; expires) if [ -n "$2" ] ; then echo "Too many arguments" >&2 exit 1 fi echo "Expiration date of $1" exit 0 ;; *) echo "Unknown command $command" >&2 exit 1 ;; esac