Example #1
0
static int notowner_lock(void)
{
    struct ne_lock dummy;

    PRECOND(gotlock);

    memcpy(&dummy, &reslock, sizeof(reslock));
    dummy.token = ne_strdup("opaquelocktoken:foobar");
    dummy.scope = ne_lockscope_exclusive;
    dummy.owner = ne_strdup("notowner lock");

    ONN("UNLOCK with bogus lock token",
	ne_unlock(i_session2, &dummy) != NE_ERROR);

    /* 2518 doesn't really say what status code that UNLOCK should
     * fail with. mod_dav gives a 400 as the locktoken is bogus.  */
    
    ONN("LOCK on locked resource",
	ne_lock(i_session2, &dummy) != NE_ERROR);
    
    if (dummy.token)  
        ne_free(dummy.token);

    if (STATUS2(423))
	t_warning("LOCK failed with %d not 423", GETSTATUS2);

    return OK;
}
Example #2
0
static int notowner_modify(void)
{
    char *tmp;
    ne_propname pname = { "http://webdav.org/neon/litmus/", "random" };
    ne_proppatch_operation pops[] = { 
	{ NULL, ne_propset, "foobar" },
	{ NULL }
    };

    PRECOND(gotlock);

    pops[0].name = &pname;

    ONN("DELETE of locked resource should fail", 
	ne_delete(i_session2, res) != NE_ERROR);

    if (STATUS2(423)) 
	t_warning("DELETE failed with %d not 423", GETSTATUS2);

    tmp = ne_concat(i_path, "whocares", NULL);
    ONN("MOVE of locked resource should fail", 
	ne_move(i_session2, 0, res, tmp) != NE_ERROR);
    free(tmp);
    
    if (STATUS2(423))
	t_warning("MOVE failed with %d not 423", GETSTATUS2);
    
    ONN("COPY onto locked resource should fail",
	ne_copy(i_session2, 1, NE_DEPTH_ZERO, res2, res) != NE_ERROR);

    if (STATUS2(423))
	t_warning("COPY failed with %d not 423", GETSTATUS2);

    ONN("PROPPATCH of locked resource should fail",
	ne_proppatch(i_session2, res, pops) != NE_ERROR);
    
    if (STATUS2(423))
	t_warning("PROPPATCH failed with %d not 423", GETSTATUS2);

    ONN("PUT on locked resource should fail",
	ne_put(i_session2, res, i_foo_fd) != NE_ERROR);

    if (STATUS2(423))
	t_warning("PUT failed with %d not 423", GETSTATUS2);

    return OK;    
}
Example #3
0
void printNBI(PSZ pszObject,
              struct netbios_info_1* pNBI)
{
  PSZ pszDriverType;
  
  // determine driver type
  switch (pNBI->nb1_driver_type)
  {
    case 1:
      pszDriverType = "network control block";
      break;
    
    case 2:
      pszDriverType = "message control block";
      break;
    
    default:
      pszDriverType = "unknown";
      break;
  }
    
  printf("Information on %s:\n"
         "  net name           = [%s]\n"
         "  driver name        = [%s]\n"
         "  lan adapter number = %d\n"
         "  (pad 1)            = %02xh\n"
         "  driver type        = %04xh (%s)\n"
         "  net status         = %04xh\n"
         "  net bandwidth      = %08xh (bit/sec?)\n"
         "  maximum sessions   = %d\n"
         "  maximum NCBs       = %d\n"
         "  maximum names      = %d\n",
         pszObject,
         pNBI->nb1_net_name,
         pNBI->nb1_driver_name,
         pNBI->nb1_lana_num,
         pNBI->nb1_pad_1,
         pNBI->nb1_driver_type, pszDriverType,
         pNBI->nb1_net_status,
         pNBI->nb1_net_bandwidth,
         pNBI->nb1_max_sess,
         pNBI->nb1_max_ncbs,
         pNBI->nb1_max_names);
  
  printf("  Status is: \n");
  
#define STATUS(a,b)                                    \
  printf("    %-50s: %s\n",                            \
         a,                                            \
         ((pNBI->nb1_net_status & b) == b) ? "yes" : "no");

#define STATUS2(a,b)                                   \
  if ( ((pNBI->nb1_net_status & b) == b) )             \
    printf("    %-50s: is set\n",                       \
         a);
  
  STATUS("LAN is managed by redirector",                NB_LAN_MANAGED)
  STATUS("LAN is a loopback driver",                    NB_LAN_LOOPBACK)
  STATUS("LAN allows SendNoAck NCBs",                   NB_LAN_SENDNOACK)
  STATUS("LAN supports LAN Manager extended NCBs",      NB_LAN_LMEXT)
  STATUS("LAN allows NCB submission at interrupt time", NB_LAN_INTNCB)
  STATUS2("undefined bit 0x0020",                        0x20)
  STATUS("LAN does not allow reset NCBs",               NB_LAN_NORESET)
  STATUS2("undefined bit 0x0080",                        0x80)
  STATUS2("undefined bit 0x0100",                        0x100)
  STATUS2("undefined bit 0x0200",                        0x200)
  STATUS2("undefined bit 0x0400",                        0x400)
  STATUS2("undefined bit 0x0800",                        0x800)
  STATUS2("undefined bit 0x1000",                        0x1000)
  STATUS2("undefined bit 0x2000",                        0x2000)
    
  switch ( (pNBI->nb1_net_status & NB_OPEN_MODE_MASK) )
  {
    case 0:
      printf("    The network software is not started.\n");
      break;
    
    case NB_OPEN_REGULAR:
      printf("    The software is operating in regular mode.\n");
      break;
    
    case NB_OPEN_PRIVILEGED:
      printf("    The software is operating in privileged mode.\n");
      break;
    
    case NB_OPEN_EXCLUSIVE:
      printf("    The software is operating in exclusive mode.\n");
      break;
  }

#undef STATUS
#undef STATUS2
}