[DGD]access.deny

Erwin Harte harte at xs4all.nl
Tue Nov 28 15:22:54 CET 2000


On Tue, Nov 28, 2000 at 07:42:10AM -0600, Lord Lerkista wrote:
> 
> Well i implement an access.deny that works!! =)

:-)

> in user.c
> 
> --------

May I suggest, in your own interest and in the interest of others
reading your code, that you indent it?  Something like this:

  ----------------------------------------------------------------------
  static void open() {
      int    i;
      string archivo, *ips, ip, mensaje, a, a1, b, b1, c, c1, d, d1;

      rlimits(MAXDEPTH;MAXTICKS){
          timestamp=time();
          echo=1;
          set_this_player(player);
          HNAME->request_ip_name(query_ip_number(player));
          ip=query_ip_number(player);
          archivo=read_file("/txt/access.deny");
          if (archivo) {
              ips=explode(archivo,"\n");
              for (i=0; i<sizeof(ips); i++) {
                  if (sscanf(ips[i],"%s.%s.%s.%s:%s",a,b,c,d,mensaje)==5) {
                      sscanf(ip,"%s.%s.%s.%s",a1,b1,c1,d1);
                      if(a==a1 && b==b1 && c==c1 && d==d1){
                          player->catch_tell(mensaje+"\n");
                          call_out("destruye",1);
                          return;
                      }
                      if (a==a1 && b==b1 && c==c1 && d=="*") {
                          player->catch_tell(mensaje+"\n");
                          call_out("destruye",1);
                          return;
                      }
                      if (a==a1 && b==b1 && c=="*") {
                          player->catch_tell(mensaje+"\n");
                          call_out("destruye",1);
                          return;
                      }
                      if (a==a1 && b=="*") {
                          player->catch_tell(mensaje+"\n");
                          call_out("destruye",1);
                          return;
                      }
                  }
              }
          }
          player->_F_call("logon");
      }
  }

  static void destruye() {
      player=0;
      destruct(this_object());
      return 1;
  }
  ----------------------------------------------------------------------

This makes it a lot easier to see what is actually happening. :-)

What's your next step, read both access.deny and access.allow?
A possible reason for doing that is if you deny "a.b.c.*", but want to
allow one ipnumber in that same range after all, say "a.b.c.d".

Keep up the good work!

Erwin.
-- 
Erwin Harte         :    `Don't mind Erwin, he gets crabby. :)'
harte at xs4all.nl     :       -- Par Winzell <zell at skotos.net>

List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list