#include <ctype.h>
#include <vlc_acl.h>
-#include <errno.h>
-
#include <vlc_network.h>
-#include <vlc_charset.h>
+#include <vlc_fs.h>
/* FIXME: rwlock on acl, but libvlc doesn't implement rwlock */
typedef struct vlc_acl_entry_t
break;
}
-#if defined (HAVE_GETADDRINFO) || defined (WIN32)
- /* unfortunately many people define AF_INET6
- though they don't have struct sockaddr_in6 */
+#ifdef AF_INET6
case AF_INET6:
{
struct sockaddr_in6 *addr;
default:
msg_Err( p_this, "unknown address family" );
- vlc_freeaddrinfo( res );
+ freeaddrinfo( res );
return -1;
}
- vlc_freeaddrinfo( res );
+ freeaddrinfo( res );
return i_family;
}
return 0;
}
-
+#undef ACL_Create
/**
* Creates an empty ACL.
*
*
* @return an ACL object. NULL in case of error.
*/
-vlc_acl_t *__ACL_Create( vlc_object_t *p_this, bool b_allow )
+vlc_acl_t *ACL_Create( vlc_object_t *p_this, bool b_allow )
{
vlc_acl_t *p_acl;
return p_acl;
}
-
+#undef ACL_Duplicate
/**
* Perform a deep copy of an existing ACL.
*
*
* @return a new ACL object, or NULL on error.
*/
-vlc_acl_t *__ACL_Duplicate( vlc_object_t *p_this, const vlc_acl_t *p_acl )
+vlc_acl_t *ACL_Duplicate( vlc_object_t *p_this, const vlc_acl_t *p_acl )
{
vlc_acl_t *p_dupacl;
if( p_acl == NULL )
return -1;
- file = utf8_fopen( psz_path, "r" );
+ file = vlc_fopen( psz_path, "r" );
if( file == NULL )
return -1;
continue;
ptr = strchr( psz_ip, '\n' );
- if( ptr == NULL )
+ if( ptr == NULL && !feof(file) )
{
msg_Warn( p_acl->p_owner, "skipping overly long line in %s",
psz_path);
continue; /* skip unusable line */
}
- /* skips comment-only line */
- if( *psz_ip == '#' )
- continue;
-
- /* looks for first space, CR, LF, etc. or end-of-line comment */
- /* (there is at least a linefeed) */
- for( ptr = psz_ip; ( *ptr != '#' ) && !isspace( *ptr ); ptr++ );
+ /* look for first space, CR, LF, etc. or comment character */
+ for( ptr = psz_ip; ( *ptr!='#' ) && !isspace( *ptr ) && *ptr; ++ptr );
*ptr = '\0';
+ /* skip lines without usable information */
+ if( ptr == psz_ip )
+ continue;
+
msg_Dbg( p_acl->p_owner, "restricted to %s", psz_ip );
ptr = strchr( psz_ip, '/' );