inetd.c源代码分析之处理inetd.conf文件的结果

来源:互联网 发布:ubuntu 调整时区 编辑:程序博客网 时间:2024/06/06 02:38
下面是inetd.conf的文件内容

tftp        dgram    udp    wait    nobody    /usr/sbin/tcpd    /usr/sbin/tftpd -l /home/ch/tftpboot
                                                                调用的程序       参数一               参数二 
void
run_service (int ctrl, struct servtab *sep)
{



      execv (sep->se_server, sep->se_argv);
      if (sep->se_socktype != SOCK_STREAM)
    recv (0, buf, sizeof buf, 0);
      syslog (LOG_ERR, "cannot execute %s: %m", sep->se_server);
      _exit (EXIT_FAILURE);
    }
}



struct servtab *
getconfigent (FILE *fconfig, const char *file, size_t *line)
{



      for (i = 0; i < sep->se_argc; i++)
    {
      sep->se_argv[i] = argv[INETD_SERVER_ARGS + i];
      if (debug)
    fprintf (stderr, "sep->se_argv[%d] =  %s\n",i,sep->se_argv[i]);
 
     argv[INETD_SERVER_ARGS + i] = 0;
    }





root@ch-Founder-PC:~/inetutils-1.9.4/src# ./inetd -d
Using pid-file at "/var/run/inetd.pid".
sep->se_argv[0] =  /usr/sbin/tftpd
sep->se_argv[1] =  -l
sep->se_argv[2] =  /home/ch/tftpboot
sep->se_argv[3] =  (null)
/
etc/inetd.conf:32: ADD : *:tftp proto=udp, wait=1, max=0, user=nobody group= builtin=no server=/usr/sbin/tcpd
registered /usr/sbin/tcpd on 4
inetd: /etc/inetd.d, No such file or directory
原创粉丝点击