URI:
       tauth_wep.c - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
       tauth_wep.c (738B)
       ---
            1 #include <u.h>
            2 #include <libc.h>
            3 #include <auth.h>
            4 #include "authlocal.h"
            5 
            6 /*
            7  *  make factotum add wep keys to an 802.11 device
            8  */
            9 int
           10 auth_wep(char *dev, char *fmt, ...)
           11 {
           12         AuthRpc *rpc;
           13         char *params, *p;
           14         va_list arg;
           15         int rv;
           16 
           17         rv = -1;
           18 
           19         if(dev == nil){
           20                 werrstr("no device specified");
           21                 return rv;
           22         }
           23 
           24         rpc = auth_allocrpc();
           25         if(rpc != nil){
           26                 quotefmtinstall();        /* just in case */
           27                 va_start(arg, fmt);
           28                 params = vsmprint(fmt, arg);
           29                 va_end(arg);
           30                 if(params != nil){
           31                         p = smprint("proto=wep %s", params);
           32                         if(p != nil){
           33                                 if(auth_rpc(rpc, "start", p, strlen(p)) == ARok
           34                                 && auth_rpc(rpc, "write", dev, strlen(dev)) == ARok)
           35                                         rv = 0;
           36                                 free(p);
           37                         }
           38                         free(params);
           39                 }
           40                 auth_freerpc(rpc);
           41         }
           42         return rv;
           43 }