Example #1
0
rra_path_part*
rra_path_part_new(const rra_path_info *in_pi)
{
    if (in_pi == NULL)
    {
        return NULL;
    }

    rra_path_part *ret_val = rra_new_type(rra_path_part);
    ret_val->type = RRA_PATH_PART_EMPTY;
    ret_val->value = ustr_new();
    ret_val->encoded = ustr_new();
    ret_val->pi = in_pi;
    return ret_val;
}
Example #2
0
void
cell_debug_print_long (Cell *in_cell)
{
    ustring *xml_out = ustr_new();
    cell_get_xml_output(in_cell, xml_out, TRUE);
    fprintf (stderr, "%s", ustr_as_utf8(xml_out));
    ustr_free(xml_out);
}
Example #3
0
void
uservinfo_debug_print(const UserVInfo *in_info)
{
    ustring *ustr = ustr_new();
    if (uservinfo_get_debug_output(in_info, ustr))
    {
        fprintf (stderr, "%s", ustr_as_utf8(ustr));
    }
    ustr_free(ustr);
}
Example #4
0
void
sam_info_debug_print(const SamInfo *in_info)
{
    const SamFKey *key = get_fkey(in_info);
    ustring *ustr = ustr_new();

#define OUTPUT_PART(name)                                     \
    do {                                                      \
        ustr_printfa(ustr, "%s: ", #name);                    \
        ustr_hexstreama(ustr, (guint8*)&key->name, 0,         \
                        sizeof(key->name), ',');              \
        ustr_printfa(ustr, "\n");                             \
    } while(0)

    ustr_printfa(ustr, "Hexdump:\n");
    ustr_hexdumpa(ustr, value_cell_get_data(in_info->vcell),
                  0, value_cell_get_data_length(in_info->vcell), TRUE, TRUE);

    OUTPUT_PART(id);
    OUTPUT_PART(u4);
    OUTPUT_PART(u8);
    OUTPUT_PART(autoinc);
    OUTPUT_PART(u20);
    OUTPUT_PART(max_password_age);
    OUTPUT_PART(min_password_age);
    OUTPUT_PART(u40);
    OUTPUT_PART(lockout_duration);
    OUTPUT_PART(lockout_reset);
    OUTPUT_PART(u64);
    OUTPUT_PART(next_rid);
    OUTPUT_PART(flags);
    OUTPUT_PART(min_pass);
    OUTPUT_PART(enforce_password_history);
    OUTPUT_PART(lockout_threshold);
    OUTPUT_PART(u78);
    OUTPUT_PART(u80);
    OUTPUT_PART(u84);
    OUTPUT_PART(u88);
    OUTPUT_PART(u92);
    OUTPUT_PART(u94);
    OUTPUT_PART(u96);
    OUTPUT_PART(u100);
    OUTPUT_PART(obf);

    ustr_printfa(ustr, "\n");

    fprintf (stderr, "%s", ustr_as_utf8(ustr));
    ustr_free(ustr);
}
Example #5
0
static const ustring*
get_ustring_val(const UserVInfo *in_info, uv_field in_field)
{
    if (in_info == NULL)
    {
        return NULL;
    }

    if (in_info->vals[in_field] == NULL)
    {
        finfo *fi = get_finfo(in_info);
        ustring *tmp_str = ustr_new();
        ustr_strnset_type(tmp_str, USTR_TYPE_UTF16LE,
                          (char*)(fi->data + fi->e[in_field].off),
                          fi->e[in_field].len);
        ((UserVInfo*)in_info)->vals[in_field] = tmp_str;
    }

    return in_info->vals[in_field];
}
Example #6
0
/** Puts a string on the console .*/
int bbconsole_puts(BBConsole * self, const char * str) {
  int index;
  int size     = strlen(str);
  int leftsize = size;
  int lines = 0;
  USTR_INFO uinfo;
  BBTextInfo info = { 0, 0, 0, 0};
  info.maxwidth   = bbwidget_w(&self->widget) - 10;
  USTR * ustr;
  const USTR * uline;
  ustr = ustr_new(str);
  while(bbtextinfo_linefromtext(&info, ustr, self->widget.style.font)) {
    uline = bbtextinfo_refustr(&info, &uinfo, ustr);
    bbconsole_addustr(self, uline);
    // don't forget to skip to next line!!!
    bbtextinfo_next(&info);
  }
  uline = bbtextinfo_refustr(&info, &uinfo, ustr);
  bbconsole_addustr(self, uline);
  ustr_free(ustr);
  return lines;
} 
Example #7
0
const char*
aclist_to_sddl(const ACList *in_aclist)
{
    if (in_aclist == NULL)
    {
        return NULL;
    }

    if (in_aclist->sddl == NULL)
    {
        int i;
        ((ACList*)in_aclist)->sddl = ustr_new();

        for (i = 0; i < aclist_get_acentry_count(in_aclist); i++)
        {
            ustr_printfa(in_aclist->sddl, "(%s)",
                         acentry_to_sddl(aclist_get_acentry(in_aclist, i)));
        }
    }

    return ustr_as_utf8(in_aclist->sddl);
}
Example #8
0
/** Initializes a console. */
BBConsole * bbconsole_initall(BBConsole * self, int id, Rebox bounds, Style style) {
  if(!self) return NULL;
  if(!bbwidget_initall(&self->widget, id, bbconsole_actions, bounds, style)) { 
    return NULL;
  }
  ustrlist_init(&self->text);
  // ustrlist_shiftcstr(&self->text, "empty line");
  bbwidget_active_(&self->widget, FALSE);
  self->count = 0;
  // max MUST be at least 2, 3 to see anything...
  self->max   = BBCONSOLE_MAX;
  self->start = 0;
  self->charw = 80; 
  self->buf   = mem_alloc(self->charw + 1);
   // one extra for NULL at end . 
  if(!self->buf) { bbconsole_done(&self->widget, NULL); return NULL; }
  self->input = ustr_new("");
  self->cursor= 0;
  if(!self->input) { bbconsole_done(&self->widget, NULL); return NULL; }
  self->command      = NULL;
  self->command_data = NULL;
  return self;
}