plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

pass.c (568B)


      1 /*
      2  * This is just a repository for a password.
      3  * We don't want to encourage this, there's
      4  * no server side.
      5  *
      6  * Client:
      7  *	start proto=pass ...
      8  *	read password
      9  */
     10 
     11 #include "std.h"
     12 #include "dat.h"
     13 
     14 static int
     15 passproto(Conv *c)
     16 {
     17 	Key *k;
     18 
     19 	k = keyfetch(c, "%A", c->attr);
     20 	if(k == nil)
     21 		return -1;
     22 	c->state = "write";
     23 	convprint(c, "%q %q",
     24 		strfindattr(k->attr, "user"),
     25 		strfindattr(k->privattr, "!password"));
     26 	return 0;
     27 }
     28 
     29 static Role passroles[] = {
     30 	"client",	passproto,
     31 	0
     32 };
     33 
     34 Proto pass =
     35 {
     36 	"pass",
     37 	passroles,
     38 	"user? !password?",
     39 	nil,
     40 	nil
     41 };