/* $Id: sfsauthd.C,v 1.5 2002/01/06 19:30:36 dm Exp $ */ /* * * Copyright (C) 2001 David Mazieres (dm@uun.org) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2, 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, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * */ #include "authdb.h" int main (int argc, char **argv) { setprogname (argv[0]); sfsauth_dbrec dbr, dbr2; str s; dbr.set_type (SFSAUTH_USER); dbr.userinfo->name = "testuser"; dbr.userinfo->id = 666; dbr.userinfo->vers = 3; dbr.userinfo->gid = 666; dbr.userinfo->pubkey = "0xaffab1edeadbeefacc01ade"; dbr.userinfo->privs = "a"; dbr.userinfo->audit = "did_something_bad"; rpc_print (warn, dbr); s = authdbrec2str (&dbr); warn << "here it is\n" << s << "\n"; if (!str2authdbrec (&dbr2, s)) fatal ("didn't parse\n"); rpc_print (warn, dbr2); dbr.set_type (SFSAUTH_GROUP); dbr.groupinfo->name = "testgroup"; dbr.groupinfo->id = 666; dbr.groupinfo->vers = 7; dbr.groupinfo->members.setsize (2); dbr.groupinfo->members[0] = "dm"; dbr.groupinfo->members[1] = "root"; dbr.groupinfo->audit = "changed by an intruder"; rpc_print (warn, dbr); s = authdbrec2str (&dbr); warn << "here it is\n" << s << "\n"; if (!str2authdbrec (&dbr2, s)) fatal ("didn't parse\n"); rpc_print (warn, dbr2); return 0; }