19 #include <my_global.h> 
   25 #define MAX_SERVICE_NAME_LENGTH  1024 
   41   typedef enum {INFO, WARNING, ERROR}  type;
 
   44 extern "C" int opt_auth_win_log_level;
 
   45 unsigned int  get_log_level(
void);
 
   46 void          set_log_level(
unsigned int);
 
   62 #if defined(DEBUG_ERROR_LOG) && defined(DBUG_OFF) 
   63 #define ERROR_LOG(Level, Msg)     do {} while (0) 
   65 #define ERROR_LOG(Level, Msg)     error_log_print< error_log_level::Level > Msg 
   69 void error_log_vprint(error_log_level::type 
level,
 
   70                       const char *
fmt, va_list args);
 
   72 template <error_log_level::type Level>
 
   73 void error_log_print(
const char *
fmt, ...)
 
   77   error_log_vprint(Level, fmt, args);
 
   81 typedef char Error_message_buf[1024];
 
   82 const char* get_last_error_message(Error_message_buf);
 
   97 #define DBUG_PRINT_DO(Keyword, Msg) \ 
   99     if (4 > get_log_level()) break; \ 
  100     fprintf(stderr, "winauth: %s: ", Keyword); \ 
  105 void debug_msg(
const char *
fmt, ...)
 
  109   vfprintf(stderr, fmt, args);
 
  116 #define DBUG_PRINT_DO(K, M)  do {} while (0) 
  120 #ifndef WINAUTH_USE_DBUG_LIB 
  123 #define DBUG_PRINT(Keyword, Msg)  DBUG_PRINT_DO(Keyword, Msg) 
  131 #define DBUG_ENTER(X)  do {} while (0) 
  134 #define DBUG_RETURN(X) return (X) 
  138 #define DBUG_ASSERT(X) assert (X) 
  140 #define DBUG_ASSERT(X) do {} while (0) 
  144 #define DBUG_DUMP(A,B,C) do {} while (0) 
  151 typedef unsigned char byte;
 
  167   Blob(): m_ptr(NULL), m_len(0)
 
  170   Blob(
const byte *ptr, 
const size_t len)
 
  171   : m_ptr(const_cast<byte*>(ptr)), m_len(len)
 
  174   Blob(
const char *str): m_ptr((byte*)str)
 
  189   byte& operator[](
unsigned pos)
 const 
  191     static byte out_of_range= 0;  
 
  192     return pos < len() ? m_ptr[pos] : out_of_range;
 
  197     return m_ptr == NULL;
 
  251   Sid(HANDLE sec_token);
 
  256   bool is_group(
void)
 const 
  258     return m_type == SidTypeGroup
 
  259            || m_type == SidTypeWellKnownGroup
 
  260            || m_type == SidTypeAlias;
 
  263   bool is_user(
void)
 const 
  265     return m_type == SidTypeUser;
 
  268   bool operator==(
const Sid&);
 
  270   operator PSID()
 const 
  272     return (PSID)m_data->User.Sid;
 
  303   bool is_valid()
 const 
  308   const Blob as_blob()
 const 
  310     return m_len ? 
Blob((byte*)m_buf, m_len) : Blob();
 
  313   const char* as_string()
 const 
  315     return (
const char*)m_buf;
 
  321 char*     wchar_to_utf8(
const wchar_t*, 
size_t*);
 
  322 wchar_t*  utf8_to_wchar(
const char*, 
size_t*);