- if( strcasecmp( Var, "Name" ) == 0 )
- {
- /* Der Server-Name */
- strncpy( Conf_ServerName, Arg, CLIENT_ID_LEN - 1 );
- Conf_ServerName[CLIENT_ID_LEN - 1] = '\0';
- return;
- }
- if( strcasecmp( Var, "Info" ) == 0 )
- {
- /* Server-Info-Text */
- strncpy( Conf_ServerInfo, Arg, CLIENT_INFO_LEN - 1 );
- Conf_ServerInfo[CLIENT_INFO_LEN - 1] = '\0';
- return;
- }
- if( strcasecmp( Var, "Password" ) == 0 )
- {
- /* Server-Passwort */
- strncpy( Conf_ServerPwd, Arg, CLIENT_PASS_LEN - 1 );
- Conf_ServerPwd[CLIENT_PASS_LEN - 1] = '\0';
- return;
- }
- if( strcasecmp( Var, "Ports" ) == 0 )
- {
- /* Ports, durch "," getrennt, auf denen der Server
- * Verbindungen annehmen soll */
- ptr = strtok( Arg, "," );
- while( ptr )
- {
- ngt_TrimStr( ptr );
- port = atol( ptr );
- if( Conf_ListenPorts_Count + 1 > MAX_LISTEN_PORTS ) Config_Error( LOG_ERR, "Too many listen ports configured. Port %ld ignored.", port );
+ if( strcasecmp( Var, "Name" ) == 0 ) {
+ /* Server name */
+ len = strlcpy( Conf_ServerName, Arg, sizeof( Conf_ServerName ));
+ if (len >= sizeof( Conf_ServerName ))
+ Config_Error_TooLong( Line, Var );
+ return;
+ }
+ if( strcasecmp( Var, "Info" ) == 0 ) {
+ /* Info text of server */
+ len = strlcpy( Conf_ServerInfo, Arg, sizeof( Conf_ServerInfo ));
+ if (len >= sizeof( Conf_ServerInfo ))
+ Config_Error_TooLong ( Line, Var );
+ return;
+ }
+ if( strcasecmp( Var, "Password" ) == 0 ) {
+ /* Global server password */
+ len = strlcpy( Conf_ServerPwd, Arg, sizeof( Conf_ServerPwd ));
+ if (len >= sizeof( Conf_ServerPwd ))
+ Config_Error_TooLong( Line, Var );
+ return;
+ }
+ if( strcasecmp( Var, "AdminInfo1" ) == 0 ) {
+ /* Administrative info #1 */
+ len = strlcpy( Conf_ServerAdmin1, Arg, sizeof( Conf_ServerAdmin1 ));
+ if (len >= sizeof( Conf_ServerAdmin1 ))
+ Config_Error_TooLong ( Line, Var );
+ return;
+ }
+ if( strcasecmp( Var, "AdminInfo2" ) == 0 ) {
+ /* Administrative info #2 */
+ len = strlcpy( Conf_ServerAdmin2, Arg, sizeof( Conf_ServerAdmin2 ));
+ if (len >= sizeof( Conf_ServerAdmin2 ))
+ Config_Error_TooLong ( Line, Var );
+ return;
+ }
+ if( strcasecmp( Var, "AdminEMail" ) == 0 ) {
+ /* Administrative email contact */
+ len = strlcpy( Conf_ServerAdminMail, Arg, sizeof( Conf_ServerAdminMail ));
+ if (len >= sizeof( Conf_ServerAdminMail ))
+ Config_Error_TooLong( Line, Var );
+ return;
+ }
+
+ if( strcasecmp( Var, "Ports" ) == 0 ) {
+ ports_parse(&Conf_ListenPorts, Line, Arg);
+ return;
+ }
+ if( strcasecmp( Var, "MotdFile" ) == 0 ) {
+ /* "Message of the day" (MOTD) file */
+ len = strlcpy( Conf_MotdFile, Arg, sizeof( Conf_MotdFile ));
+ if (len >= sizeof( Conf_MotdFile ))
+ Config_Error_TooLong( Line, Var );
+ return;
+ }
+ if( strcasecmp( Var, "MotdPhrase" ) == 0 ) {
+ /* "Message of the day" phrase (instead of file) */
+ len = strlcpy( Conf_MotdPhrase, Arg, sizeof( Conf_MotdPhrase ));
+ if (len >= sizeof( Conf_MotdPhrase ))
+ Config_Error_TooLong( Line, Var );
+ return;
+ }
+ if( strcasecmp( Var, "ChrootDir" ) == 0 ) {
+ /* directory for chroot() */
+ len = strlcpy( Conf_Chroot, Arg, sizeof( Conf_Chroot ));
+ if (len >= sizeof( Conf_Chroot ))
+ Config_Error_TooLong( Line, Var );
+ return;
+ }
+ if ( strcasecmp( Var, "PidFile" ) == 0 ) {
+ /* name of pidfile */
+ len = strlcpy( Conf_PidFile, Arg, sizeof( Conf_PidFile ));
+ if (len >= sizeof( Conf_PidFile ))
+ Config_Error_TooLong( Line, Var );
+ return;
+ }
+ if( strcasecmp( Var, "ServerUID" ) == 0 ) {
+ /* UID the daemon should switch to */
+ pwd = getpwnam( Arg );
+ if( pwd ) Conf_UID = pwd->pw_uid;
+ else {
+#ifdef HAVE_ISDIGIT
+ if( ! isdigit( (int)*Arg )) Config_Error_NaN( Line, Var );