本文整理汇总了C++中d_printf函数的典型用法代码示例。如果您正苦于以下问题:C++ d_printf函数的具体用法?C++ d_printf怎么用?C++ d_printf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了d_printf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: send_cldap_netlogon
/*
do a cldap netlogon query
*/
static int send_cldap_netlogon(int sock, const char *domain,
const char *hostname, unsigned ntversion)
{
ASN1_DATA data;
char ntver[4];
#ifdef CLDAP_USER_QUERY
char aac[4];
SIVAL(aac, 0, 0x00000180);
#endif
SIVAL(ntver, 0, ntversion);
memset(&data, 0, sizeof(data));
asn1_push_tag(&data,ASN1_SEQUENCE(0));
asn1_write_Integer(&data, 4);
asn1_push_tag(&data, ASN1_APPLICATION(3));
asn1_write_OctetString(&data, NULL, 0);
asn1_write_enumerated(&data, 0);
asn1_write_enumerated(&data, 0);
asn1_write_Integer(&data, 0);
asn1_write_Integer(&data, 0);
asn1_write_BOOLEAN2(&data, False);
asn1_push_tag(&data, ASN1_CONTEXT(0));
asn1_push_tag(&data, ASN1_CONTEXT(3));
asn1_write_OctetString(&data, "DnsDomain", 9);
asn1_write_OctetString(&data, domain, strlen(domain));
asn1_pop_tag(&data);
asn1_push_tag(&data, ASN1_CONTEXT(3));
asn1_write_OctetString(&data, "Host", 4);
asn1_write_OctetString(&data, hostname, strlen(hostname));
asn1_pop_tag(&data);
#ifdef CLDAP_USER_QUERY
asn1_push_tag(&data, ASN1_CONTEXT(3));
asn1_write_OctetString(&data, "User", 4);
asn1_write_OctetString(&data, "SAMBA$", 6);
asn1_pop_tag(&data);
asn1_push_tag(&data, ASN1_CONTEXT(3));
asn1_write_OctetString(&data, "AAC", 4);
asn1_write_OctetString(&data, aac, 4);
asn1_pop_tag(&data);
#endif
asn1_push_tag(&data, ASN1_CONTEXT(3));
asn1_write_OctetString(&data, "NtVer", 5);
asn1_write_OctetString(&data, ntver, 4);
asn1_pop_tag(&data);
asn1_pop_tag(&data);
asn1_push_tag(&data,ASN1_SEQUENCE(0));
asn1_write_OctetString(&data, "NetLogon", 8);
asn1_pop_tag(&data);
asn1_pop_tag(&data);
asn1_pop_tag(&data);
if (data.has_error) {
d_printf("Failed to build cldap netlogon at offset %d\n", (int)data.ofs);
asn1_free(&data);
return -1;
}
if (write(sock, data.data, data.length) != (ssize_t)data.length) {
d_printf("failed to send cldap query (%s)\n", strerror(errno));
}
asn1_free(&data);
return 0;
}
开发者ID:hajuuk,项目名称:R7000,代码行数:77,代码来源:net_ads_cldap.c
示例2: SMBC_write_ctx
ssize_t
SMBC_write_ctx(SMBCCTX *context,
SMBCFILE *file,
const void *buf,
size_t count)
{
off_t offset;
char *server = NULL, *share = NULL, *user = NULL, *password = NULL;
char *path = NULL;
char *targetpath = NULL;
struct cli_state *targetcli = NULL;
TALLOC_CTX *frame = talloc_stackframe();
NTSTATUS status;
/* First check all pointers before dereferencing them */
if (!context || !context->internal->initialized) {
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
}
if (!file || !SMBC_dlist_contains(context->internal->files, file)) {
errno = EBADF;
TALLOC_FREE(frame);
return -1;
}
/* Check that the buffer exists ... */
if (buf == NULL) {
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
}
offset = file->offset; /* See "offset" comment in SMBC_read_ctx() */
/*d_printf(">>>write: parsing %s\n", file->fname);*/
if (SMBC_parse_path(frame,
context,
file->fname,
NULL,
&server,
&share,
&path,
&user,
&password,
NULL)) {
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
}
/*d_printf(">>>write: resolving %s\n", path);*/
status = cli_resolve_path(frame, "", context->internal->auth_info,
file->srv->cli, path,
&targetcli, &targetpath);
if (!NT_STATUS_IS_OK(status)) {
d_printf("Could not resolve %s\n", path);
errno = ENOENT;
TALLOC_FREE(frame);
return -1;
}
/*d_printf(">>>write: resolved path as %s\n", targetpath);*/
status = cli_writeall(targetcli, file->cli_fd,
0, (const uint8_t *)buf, offset, count, NULL);
if (!NT_STATUS_IS_OK(status)) {
errno = map_errno_from_nt_status(status);
TALLOC_FREE(frame);
return -1;
}
file->offset += count;
TALLOC_FREE(frame);
return count; /* Success, 0 bytes of data ... */
}
开发者ID:sprymak,项目名称:samba,代码行数:79,代码来源:libsmb_file.c
示例3: SMBC_close_ctx
int
SMBC_close_ctx(SMBCCTX *context,
SMBCFILE *file)
{
SMBCSRV *srv;
char *server = NULL, *share = NULL, *user = NULL, *password = NULL;
char *path = NULL;
char *targetpath = NULL;
struct cli_state *targetcli = NULL;
TALLOC_CTX *frame = talloc_stackframe();
NTSTATUS status;
if (!context || !context->internal->initialized) {
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
}
if (!file || !SMBC_dlist_contains(context->internal->files, file)) {
errno = EBADF;
TALLOC_FREE(frame);
return -1;
}
/* IS a dir ... */
if (!file->file) {
TALLOC_FREE(frame);
return smbc_getFunctionClosedir(context)(context, file);
}
/*d_printf(">>>close: parsing %s\n", file->fname);*/
if (SMBC_parse_path(frame,
context,
file->fname,
NULL,
&server,
&share,
&path,
&user,
&password,
NULL)) {
errno = EINVAL;
TALLOC_FREE(frame);
return -1;
}
/*d_printf(">>>close: resolving %s\n", path);*/
status = cli_resolve_path(frame, "", context->internal->auth_info,
file->srv->cli, path,
&targetcli, &targetpath);
if (!NT_STATUS_IS_OK(status)) {
d_printf("Could not resolve %s\n", path);
errno = ENOENT;
TALLOC_FREE(frame);
return -1;
}
/*d_printf(">>>close: resolved path as %s\n", targetpath);*/
if (!NT_STATUS_IS_OK(cli_close(targetcli, file->cli_fd))) {
DEBUG(3, ("cli_close failed on %s. purging server.\n",
file->fname));
/* Deallocate slot and remove the server
* from the server cache if unused */
errno = SMBC_errno(context, targetcli);
srv = file->srv;
DLIST_REMOVE(context->internal->files, file);
SAFE_FREE(file->fname);
SAFE_FREE(file);
smbc_getFunctionRemoveUnusedServer(context)(context, srv);
TALLOC_FREE(frame);
return -1;
}
DLIST_REMOVE(context->internal->files, file);
SAFE_FREE(file->fname);
SAFE_FREE(file);
TALLOC_FREE(frame);
return 0;
}
开发者ID:sprymak,项目名称:samba,代码行数:79,代码来源:libsmb_file.c
示例4: bl_execute
/* Execute a command, with optional params send (in[in_len]) and
** results received (out[out_len])
*/
static int bl_execute(BusLogic *bl, uchar command,
void *in, int in_len,
void *out, int out_len)
{
uchar status;
uchar *_in, *_out;
#ifdef TIMEOUT
int timeout;
#endif
_in = (uchar *) in;
_out = (uchar *) out;
if(!(inb(BL_STATUS_REG) & BL_STATUS_HARDY)) {
d_printf("buslogic: command 0x%02x %d/%d, not ready\n",
command, in_len, out_len);
return 1;
}
outb(BL_COMMAND_REG, command);
#ifdef TIMEOUT
timeout = 100;
#endif
while(in_len) {
status = inb(BL_STATUS_REG);
if(status & BL_STATUS_CMDINV) {
d_printf("buslogic: command 0x%02x %d/%d invalid\n",
command, in_len, out_len);
return 1;
}
if(status & BL_STATUS_CPRBSY) {
#ifdef TIMEOUT
timeout--;
if(!timeout) {
d_printf("buslogic: command 0x%02 timed out (a)\n",command);
return 1;
}
spin(100);
#endif
continue;
}
outb(BL_COMMAND_REG, *_in);
_in++;
in_len--;
}
#ifdef TIMEOUT
timeout = 100;
#endif
while(out_len) {
status = inb(BL_STATUS_REG);
if(status & BL_STATUS_CMDINV) {
d_printf("buslogic: command 0x%02x %d/%d invalid\n",
command, in_len, out_len);
return 1;
}
if(status & BL_STATUS_DIRRDY) {
*_out = inb(BL_DATA_REG);
_out++;
out_len--;
} else {
#ifdef TIMEOUT
timeout--;
if(!timeout) {
d_printf("buslogic: command 0x%02 timed out (b)\n",command);
return 1;
}
spin(100);
#endif
}
}
#ifdef TIMEOUT
timeout = 100;
#endif
while(!(inb(BL_STATUS_REG) & BL_STATUS_HARDY)) {
#ifdef TIMEOUT
timeout--;
if(!timeout) {
d_printf("buslogic: command 0x%02 timed out (c)\n",command);
return 1;
}
spin(100);
#endif
}
return 0;
}
开发者ID:mmanley,项目名称:Antares,代码行数:92,代码来源:buslogic.c
示例5: sim_invalid
/* sim_invalid()
**
** Generic invalid XPT command response
*/
static long sim_invalid(BusLogic *bl, CCB_HEADER *ccbh)
{
ccbh->cam_status = CAM_REQ_INVALID;
d_printf("sim_invalid\n");
return B_ERROR;
}
开发者ID:mmanley,项目名称:Antares,代码行数:10,代码来源:buslogic.c
示例6: group_member_fn
static void group_member_fn(const char *user_name, void *state)
{
d_printf("%-21.21s\n", user_name);
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:4,代码来源:net_rap.c
示例7: group_fn
static void group_fn(const char *group_name, void *state)
{
d_printf("%-21.21s\n", group_name);
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:4,代码来源:net_rap.c
示例8: jpeg_display_rgb
int
jpeg_display_rgb(int argc, char *argv[])
{
u_int8_t *rgb_buf;/* RGB data */
u_int8_t *jpeg_buf; /* JPEG data */
buf_t jpeg_src_buf;
size_t read_size; /* read size from file */
int row_stride;
int w, h, d;/* display size and depth(byte) */
boolean draw_screen; /* draw screen surface or another
* surface */
int screen_status; /* 0=general 1=blue 2=red */
/* for jpeg library */
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
/* for SDL */
SDL_Surface *screen;
SDL_Surface *sdl_image = NULL;
// SDL_Rect dstrect;
/* for visualize packet loss */
SDL_Surface *sdl_img_blue = NULL;
SDL_Surface *sdl_img_red = NULL;
u_int8_t pixel_blue[]={0,0,0xff};
u_int8_t pixel_red[]={0xff,0,0};
u_int32_t tick_start, tick_now;
int buf_status; /* -1=full */
/* for realtime play */
struct timeval tv_start,tv_now;
int64_t ts_display,ts_diff;
u_int32_t ts_nowblk,ts_lastblk=0;
/* for debug */
struct timeval tv_tmp1, tv_tmp2;
/* SDL init */
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
ComplainAndExit();
}
atexit(SDL_Quit);
/* jpeg library init / get image size and depth */
cinfo.err = jpeg_std_error(&jerr);
cinfo.err->error_exit = my_jpeg_abort_decompress;
jpeg_create_decompress(&cinfo);
#ifdef USE_JPEG_MEM_SRC
jpeg_buf = jpeg_mem_src_init(&cinfo, JPEG_BUF_MAX); /* init */
#else
jpeg_buf = (u_int8_t *) malloc(JPEG_BUF_MAX);
#endif
decoder_buf_read();
read_size = decoder_buf_get(jpeg_buf, JPEG_BUF_MAX,&ts_nowblk);
#ifdef USE_JPEG_MEM_SRC
jpeg_mem_src(&cinfo, jpeg_buf, read_size); /* read from memory */
#else
jpeg_src_buf.buf = jpeg_buf;
jpeg_buf_src(&cinfo, jpeg_buf, read_size); /* read from memory */
#endif
jpeg_read_header(&cinfo, TRUE);
w = cinfo.image_width;
h = cinfo.image_height;
d = cinfo.num_components;
jpeg_abort_decompress(&cinfo);
d_printf("\nJPEG info: image=(%d,%d), output=(%d,%d), Bpp=%d\n",
cinfo.image_width, cinfo.image_height, w, h, d);
/* SDL setup / cleanup screen-surface */
screen = SDL_SetVideoMode(w, h, 0, SDL_HWSURFACE);
if (screen == NULL) {
ComplainAndExit();
}
if (OPT.loss_visual){
sdl_img_blue = SDL_CreateRGBSurface(
SDL_HWSURFACE, w, h, 24
,OPT.sdl_mask_R, OPT.sdl_mask_G
,OPT.sdl_mask_B, OPT.sdl_mask_A);
sdl_img_red = SDL_CreateRGBSurface(
SDL_HWSURFACE, w, h, 24
,OPT.sdl_mask_R, OPT.sdl_mask_G
,OPT.sdl_mask_B, OPT.sdl_mask_A);
jpeg_fillimg1color(sdl_img_red,pixel_red,3);
jpeg_fillimg1color(sdl_img_blue,pixel_blue,3);
}
if (screen->format->BytesPerPixel == RGB_PIXELSIZE &&
screen->format->Rmask == OPT.sdl_mask_R &&
screen->format->Gmask == OPT.sdl_mask_G &&
screen->format->Bmask == OPT.sdl_mask_B) {
draw_screen = TRUE;
} else {
draw_screen = FALSE;
}
//.........这里部分代码省略.........
开发者ID:emon,项目名称:emon,代码行数:101,代码来源:jpegplay.c
示例9: i2400m_report_tlv_system_state
/*
* Act on a TLV System State reported by the device
*
* @i2400m: device descriptor
* @ss: validated System State TLV
*/
static
void i2400m_report_tlv_system_state(struct i2400m *i2400m,
const struct i2400m_tlv_system_state *ss)
{
struct device *dev = i2400m_dev(i2400m);
struct wimax_dev *wimax_dev = &i2400m->wimax_dev;
enum i2400m_system_state i2400m_state = le32_to_cpu(ss->state);
d_fnstart(3, dev, "(i2400m %p ss %p [%u])\n", i2400m, ss, i2400m_state);
if (unlikely(i2400m->ready == 0)) /* act if up */
goto out;
if (i2400m->state != i2400m_state) {
i2400m->state = i2400m_state;
wake_up_all(&i2400m->state_wq);
}
switch (i2400m_state) {
case I2400M_SS_UNINITIALIZED:
case I2400M_SS_INIT:
case I2400M_SS_CONFIG:
case I2400M_SS_PRODUCTION:
wimax_state_change(wimax_dev, WIMAX_ST_UNINITIALIZED);
break;
case I2400M_SS_RF_OFF:
case I2400M_SS_RF_SHUTDOWN:
wimax_state_change(wimax_dev, WIMAX_ST_RADIO_OFF);
break;
case I2400M_SS_READY:
case I2400M_SS_STANDBY:
case I2400M_SS_SLEEPACTIVE:
wimax_state_change(wimax_dev, WIMAX_ST_READY);
break;
case I2400M_SS_CONNECTING:
case I2400M_SS_WIMAX_CONNECTED:
wimax_state_change(wimax_dev, WIMAX_ST_READY);
break;
case I2400M_SS_SCAN:
case I2400M_SS_OUT_OF_ZONE:
wimax_state_change(wimax_dev, WIMAX_ST_SCANNING);
break;
case I2400M_SS_IDLE:
d_printf(1, dev, "entering BS-negotiated idle mode\n");
case I2400M_SS_DISCONNECTING:
case I2400M_SS_DATA_PATH_CONNECTED:
wimax_state_change(wimax_dev, WIMAX_ST_CONNECTED);
break;
default:
/* Huh? just in case, shut it down */
dev_err(dev, "HW BUG? unknown state %u: shutting down\n",
i2400m_state);
i2400m->bus_reset(i2400m, I2400M_RT_WARM);
break;
};
out:
d_fnend(3, dev, "(i2400m %p ss %p [%u]) = void\n",
i2400m, ss, i2400m_state);
}
开发者ID:ClarkChen633,项目名称:rtl819x-toolchain,代码行数:69,代码来源:control.c
示例10: do_connect
static NTSTATUS do_connect(TALLOC_CTX *ctx,
const char *server,
const char *share,
const struct user_auth_info *auth_info,
bool show_sessetup,
bool force_encrypt,
int max_protocol,
int port,
int name_type,
struct cli_state **pcli)
{
struct cli_state *c = NULL;
char *servicename;
char *sharename;
char *newserver, *newshare;
const char *username;
const char *password;
NTSTATUS status;
int flags = 0;
/* make a copy so we don't modify the global string 'service' */
servicename = talloc_strdup(ctx,share);
if (!servicename) {
return NT_STATUS_NO_MEMORY;
}
sharename = servicename;
if (*sharename == '\\') {
sharename += 2;
if (server == NULL) {
server = sharename;
}
sharename = strchr_m(sharename,'\\');
if (!sharename) {
return NT_STATUS_NO_MEMORY;
}
*sharename = 0;
sharename++;
}
if (server == NULL) {
return NT_STATUS_INVALID_PARAMETER;
}
if (get_cmdline_auth_info_use_kerberos(auth_info)) {
flags |= CLI_FULL_CONNECTION_USE_KERBEROS;
}
if (get_cmdline_auth_info_fallback_after_kerberos(auth_info)) {
flags |= CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS;
}
if (get_cmdline_auth_info_use_ccache(auth_info)) {
flags |= CLI_FULL_CONNECTION_USE_CCACHE;
}
status = cli_connect_nb(
server, NULL, port, name_type, NULL,
get_cmdline_auth_info_signing_state(auth_info),
flags, &c);
if (!NT_STATUS_IS_OK(status)) {
d_printf("Connection to %s failed (Error %s)\n",
server,
nt_errstr(status));
return status;
}
if (max_protocol == 0) {
max_protocol = PROTOCOL_NT1;
}
DEBUG(4,(" session request ok\n"));
status = cli_negprot(c, max_protocol);
if (!NT_STATUS_IS_OK(status)) {
d_printf("protocol negotiation failed: %s\n",
nt_errstr(status));
cli_shutdown(c);
return status;
}
username = get_cmdline_auth_info_username(auth_info);
password = get_cmdline_auth_info_password(auth_info);
status = cli_session_setup(c, username,
password, strlen(password),
password, strlen(password),
lp_workgroup());
if (!NT_STATUS_IS_OK(status)) {
/* If a password was not supplied then
* try again with a null username. */
if (password[0] || !username[0] ||
get_cmdline_auth_info_use_kerberos(auth_info) ||
!NT_STATUS_IS_OK(status = cli_session_setup(c, "",
"", 0,
"", 0,
lp_workgroup()))) {
d_printf("session setup failed: %s\n",
nt_errstr(status));
if (NT_STATUS_EQUAL(status,
NT_STATUS_MORE_PROCESSING_REQUIRED))
d_printf("did you forget to run kinit?\n");
cli_shutdown(c);
//.........这里部分代码省略.........
开发者ID:ekohl,项目名称:samba,代码行数:101,代码来源:clidfs.c
示例11: jpeg_display_yuv
int
jpeg_display_yuv(int argc, char *argv[])
{
u_int8_t *y_buf = NULL, *u_buf = NULL, *v_buf = NULL;
u_int8_t *yuv_buf_tmp;
u_int8_t *jpeg_buf;
buf_t jpeg_src_buf;
size_t read_size; /* read size from file */
int i, x, y, offU, offV;
int row_stride;
int w, h, d;/* display size and depth(byte) */
boolean draw_screen; /* draw screen surface or another
* surface */
/* for jpeg library */
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
/* for SDL */
SDL_Surface *screen;
SDL_Overlay *sdl_overlay = NULL;
SDL_Rect dstrect;
u_int32_t tick_start, tick_now;
/* for realtime play */
struct timeval tv_start,tv_now;
int64_t ts_display,ts_diff;
u_int32_t ts_nowblk,ts_lastblk;
/* for debug */
struct timeval tv_tmp1, tv_tmp2;
/* SDL init */
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
ComplainAndExit();
}
SDL_WM_SetCaption(OPT.title, OPT.title);
atexit(SDL_Quit);
/* jpeg library init / get image size and depth */
cinfo.err = jpeg_std_error(&jerr);
cinfo.err->error_exit = my_jpeg_abort_decompress;
jpeg_create_decompress(&cinfo);
#ifdef USE_JPEG_MEM_SRC
jpeg_buf = jpeg_mem_src_init(&cinfo, JPEG_BUF_MAX); /* init */
#else /* Mr.Okamura's */
jpeg_buf = (u_int8_t *) malloc(JPEG_BUF_MAX);
#endif
decoder_buf_read(); /* pipe -> buffer */
read_size = decoder_buf_get(jpeg_buf, JPEG_BUF_MAX,&ts_nowblk); /* buffer -> mem */
#ifdef USE_JPEG_MEM_SRC /* emon's original */
jpeg_mem_src(&cinfo, jpeg_buf, read_size);
#else /* Mr.Okamura's */
jpeg_src_buf.buf = jpeg_buf;
jpeg_buf_src(&cinfo, jpeg_buf, read_size);
#endif
jpeg_read_header(&cinfo, TRUE);
w = cinfo.image_width;
h = cinfo.image_height;
d = cinfo.num_components;
jpeg_abort_decompress(&cinfo);
offU = (w * h) * 4 / 4;
offV = (w * h) * 5 / 4;
d_printf("\nJPEG info: image=(%d,%d), output=(%d,%d), Bpp=%d\n",
cinfo.image_width, cinfo.image_height, w, h, d);
/* SDL setup */
draw_screen = FALSE; /* can I draw image VRAM directly ? */
if ((screen = SDL_SetVideoMode(w, h, 0, SDL_ASYNCBLIT)) == NULL) {
ComplainAndExit();
}
d1_printf("\nSDL screen info: bpp=%d, Bpp=%d, "
"R/G/B-mask=%06x/%06x/%06x\n",
screen->format->BitsPerPixel,
screen->format->BytesPerPixel,
screen->format->Rmask,
screen->format->Gmask,
screen->format->Bmask
);
if ((sdl_overlay = my_SDL_CreateYUVOverlay(w, h, screen)) == NULL) {
ComplainAndExit();
}
d1_printf("\nSDL surface info: format=0x%08x, planes=%d, "
"hw_overlay_flag=%d\n",
sdl_overlay->format,
sdl_overlay->planes,
sdl_overlay->hw_overlay
);
row_stride = JPEG_YCbCr_PITCH * w;
yuv_buf_tmp = malloc(JPEG_YCbCr_PITCH * w * h);
STAT.skip_count = 0;
STAT.wait_count = 0;
tick_start = SDL_GetTicks(); /* get start time */
//.........这里部分代码省略.........
开发者ID:emon,项目名称:emon,代码行数:101,代码来源:jpegplay.c
示例12: cli_resolve_path
//.........这里部分代码省略.........
/* Make sure to recreate the original string including any wildcards. */
dfs_path = cli_dfs_make_full_path(ctx, rootcli, path);
if (!dfs_path) {
return NT_STATUS_NO_MEMORY;
}
pathlen = strlen(dfs_path);
consumed = MIN(pathlen, consumed);
*pp_targetpath = talloc_strdup(ctx, &dfs_path[consumed]);
if (!*pp_targetpath) {
return NT_STATUS_NO_MEMORY;
}
dfs_path[consumed] = '\0';
/*
* *pp_targetpath is now the unconsumed part of the path.
* dfs_path is now the consumed part of the path
* (in \server\share\path format).
*/
/* Open the connection to the target server & share */
status = cli_cm_open(ctx, rootcli,
server,
share,
dfs_auth_info,
false,
cli_state_encryption_on(rootcli),
cli_state_protocol(rootcli),
0,
0x20,
targetcli);
if (!NT_STATUS_IS_OK(status)) {
d_printf("Unable to follow dfs referral [\\%s\\%s]\n",
server, share );
return status;
}
if (extrapath && strlen(extrapath) > 0) {
/* EMC Celerra NAS version 5.6.50 (at least) doesn't appear to */
/* put the trailing \ on the path, so to be save we put one in if needed */
if (extrapath[strlen(extrapath)-1] != '\\' && **pp_targetpath != '\\') {
*pp_targetpath = talloc_asprintf(ctx,
"%s\\%s",
extrapath,
*pp_targetpath);
} else {
*pp_targetpath = talloc_asprintf(ctx,
"%s%s",
extrapath,
*pp_targetpath);
}
if (!*pp_targetpath) {
return NT_STATUS_NO_MEMORY;
}
}
/* parse out the consumed mount path */
/* trim off the \server\share\ */
ppath = dfs_path;
if (*ppath != '\\') {
d_printf("cli_resolve_path: "
"dfs_path (%s) not in correct format.\n",
dfs_path );
开发者ID:ekohl,项目名称:samba,代码行数:67,代码来源:clidfs.c
示例13: ads_cldap_netlogon
/*
do a cldap netlogon query
*/
int ads_cldap_netlogon(ADS_STRUCT *ads)
{
int sock;
int ret;
struct cldap_netlogon_reply reply;
const char *target = opt_host ? opt_host : inet_ntoa(ads->ldap_ip);
sock = open_udp_socket(target, ads->ldap_port);
if (sock == -1) {
d_printf("Failed to open udp socket to %s:%u\n",
inet_ntoa(ads->ldap_ip),
ads->ldap_port);
return -1;
}
ret = send_cldap_netlogon(sock, ads->config.realm, global_myname(), 6);
if (ret != 0) {
return ret;
}
ret = recv_cldap_netlogon(sock, &reply);
close(sock);
if (ret == -1) {
return -1;
}
d_printf("Information for Domain Controller: %s\n\n",
ads->config.ldap_server_name);
d_printf("Response Type: ");
switch (reply.type) {
case SAMLOGON_AD_UNK_R:
d_printf("SAMLOGON\n");
break;
case SAMLOGON_AD_R:
d_printf("SAMLOGON_USER\n");
break;
default:
d_printf("0x%x\n", reply.type);
break;
}
d_printf("GUID: %s\n",
smb_uuid_string_static(smb_uuid_unpack_static(reply.guid)));
d_printf("Flags:\n"
"\tIs a PDC: %s\n"
"\tIs a GC of the forest: %s\n"
"\tIs an LDAP server: %s\n"
"\tSupports DS: %s\n"
"\tIs running a KDC: %s\n"
"\tIs running time services: %s\n"
"\tIs the closest DC: %s\n"
"\tIs writable: %s\n"
"\tHas a hardware clock: %s\n"
"\tIs a non-domain NC serviced by LDAP server: %s\n",
(reply.flags & ADS_PDC) ? "yes" : "no",
(reply.flags & ADS_GC) ? "yes" : "no",
(reply.flags & ADS_LDAP) ? "yes" : "no",
(reply.flags & ADS_DS) ? "yes" : "no",
(reply.flags & ADS_KDC) ? "yes" : "no",
(reply.flags & ADS_TIMESERV) ? "yes" : "no",
(reply.flags & ADS_CLOSEST) ? "yes" : "no",
(reply.flags & ADS_WRITABLE) ? "yes" : "no",
(reply.flags & ADS_GOOD_TIMESERV) ? "yes" : "no",
(reply.flags & ADS_NDNC) ? "yes" : "no");
printf("Forest:\t\t\t%s\n", reply.forest);
printf("Domain:\t\t\t%s\n", reply.domain);
printf("Domain Controller:\t%s\n", reply.hostname);
printf("Pre-Win2k Domain:\t%s\n", reply.netbios_domain);
printf("Pre-Win2k Hostname:\t%s\n", reply.netbios_hostname);
if (*reply.unk) printf("Unk:\t\t\t%s\n", reply.unk);
if (*reply.user_name) printf("User name:\t%s\n", reply.user_name);
printf("Site Name:\t\t%s\n", reply.site_name);
printf("Site Name (2):\t\t%s\n", reply.site_name_2);
d_printf("NT Version: %d\n", reply.version);
d_printf("LMNT Token: %.2x\n", reply.lmnt_token);
d_printf("LM20 Token: %.2x\n", reply.lm20_token);
return ret;
}
开发者ID:hajuuk,项目名称:R7000,代码行数:88,代码来源:net_ads_cldap.c
示例14: recv_cldap_netlogon
/*
receive a cldap netlogon reply
*/
static int recv_cldap_netlogon(int sock, struct cldap_netlogon_reply *reply)
{
int ret;
ASN1_DATA data;
DATA_BLOB blob;
DATA_BLOB os1, os2, os3;
uint32 i1;
char *p;
blob = data_blob(NULL, 8192);
ret = read(sock, blob.data, blob.length);
if (ret <= 0) {
d_printf("no reply received to cldap netlogon\n");
return -1;
}
blob.length = ret;
asn1_load(&data, blob);
asn1_start_tag(&data, ASN1_SEQUENCE(0));
asn1_read_Integer(&data, &i1);
asn1_start_tag(&data, ASN1_APPLICATION(4));
asn1_read_OctetString(&data, &os1);
asn1_start_tag(&data, ASN1_SEQUENCE(0));
asn1_start_tag(&data, ASN1_SEQUENCE(0));
asn1_read_OctetString(&data, &os2);
asn1_start_tag(&data, ASN1_SET);
asn1_read_OctetString(&data, &os3);
asn1_end_tag(&data);
asn1_end_tag(&data);
asn1_end_tag(&data);
asn1_end_tag(&data);
asn1_end_tag(&data);
if (data.has_error) {
d_printf("Failed to parse cldap reply\n");
return -1;
}
p = (char *)os3.data;
reply->type = IVAL(p, 0); p += 4;
reply->flags = IVAL(p, 0); p += 4;
memcpy(&reply->guid.info, p, UUID_FLAT_SIZE);
p += UUID_FLAT_SIZE;
p += pull_netlogon_string(reply->forest, p, (const char *)os3.data);
p += pull_netlogon_string(reply->domain, p, (const char *)os3.data);
p += pull_netlogon_string(reply->hostname, p, (const char *)os3.data);
p += pull_netlogon_string(reply->netbios_domain, p, (const char *)os3.data);
p += pull_netlogon_string(reply->netbios_hostname, p, (const char *)os3.data);
p += pull_netlogon_string(reply->unk, p, (const char *)os3.data);
if (reply->type == SAMLOGON_AD_R) {
p += pull_netlogon_string(reply->user_name, p, (const char *)os3.data);
} else {
*reply->user_name = 0;
}
p += pull_netlogon_string(reply->site_name, p, (const char *)os3.data);
p += pull_netlogon_string(reply->site_name_2, p, (const char *)os3.data);
reply->version = IVAL(p, 0);
reply->lmnt_token = SVAL(p, 4);
reply->lm20_token = SVAL(p, 6);
data_blob_free(&os1);
data_blob_free(&os2);
data_blob_free(&os3);
data_blob_free(&blob);
return 0;
}
开发者ID:hajuuk,项目名称:R7000,代码行数:78,代码来源:net_ads_cldap.c
示例15: errmsg_not_implemented
static int errmsg_not_implemented(void)
{
d_printf("\nNot implemented\n");
return 0;
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:5,代码来源:net_rap.c
示例16: i2400m_dev
/**
* i2400m_msg_to_dev - Send a control message to the device and get a response
*
* @i2400m: device descriptor
*
* @msg_skb: an skb *
*
* @buf: pointer to the buffer containing the message to be sent; it
* has to start with a &struct i2400M_l3l4_hdr and then
* followed by the payload. Once this function returns, the
* buffer can be reused.
*
* @buf_len: buffer size
*
* Returns:
*
* Pointer to skb containing the ack message. You need to check the
* pointer with IS_ERR(), as it might be an error code. Error codes
* could happen because:
*
* - the message wasn't formatted correctly
* - couldn't send the message
* - failed waiting for a response
* - the ack message wasn't formatted correctly
*
* The returned skb has been allocated with wimax_msg_to_user_alloc(),
* it contains the reponse in a netlink attribute and is ready to be
* passed up to user space with wimax_msg_to_user_send(). To access
* the payload and its length, use wimax_msg_{data,len}() on the skb.
*
* The skb has to be freed with kfree_skb() once done.
*
* Description:
*
* This function delivers a message/command to the device and waits
* for an ack to be received. The format is described in
* linux/wimax/i2400m.h. In summary, a command/get/set is followed by an
* ack.
*
* This function will not check the ack status, that's left up to the
* caller. Once done with the ack skb, it has to be kfree_skb()ed.
*
* The i2400m handles only one message at the same time, thus we need
* the mutex to exclude other players.
*
* We write the message and then wait for an answer to come back. The
* RX path intercepts control messages and handles them in
* i2400m_rx_ctl(). Reports (notifications) are (maybe) processed
* locally and then forwarded (as needed) to user space on the WiMAX
* stack message pipe. Acks are saved and passed back to us through an
* skb in i2400m->ack_skb which is ready to be given to generic
* netlink if need be.
*/
struct sk_buff *i2400m_msg_to_dev(struct i2400m *i2400m,
const void *buf, size_t buf_len)
{
int result;
struct device *dev = i2400m_dev(i2400m);
const struct i2400m_l3l4_hdr *msg_l3l4_hdr;
struct sk_buff *ack_skb;
const struct i2400m_l3l4_hdr *ack_l3l4_hdr;
size_t ack_len;
int ack_timeout;
unsigned msg_type;
unsigned long flags;
d_fnstart(3, dev, "(i2400m %p buf %p len %zu)\n",
i2400m, buf, buf_len);
if (i2400m->boot_mode)
return ERR_PTR(-ENODEV);
msg_l3l4_hdr = buf;
/* Check msg & payload consistency */
result = i2400m_msg_size_check(i2400m, msg_l3l4_hdr, buf_len);
if (result < 0)
goto error_bad_msg;
msg_type = le16_to_cpu(msg_l3l4_hdr->type);
d_printf(1, dev, "CMD/GET/SET 0x%04x %zu bytes\n",
msg_type, buf_len);
d_dump(2, dev, buf, buf_len);
/* Setup the completion, ack_skb ("we are waiting") and send
* the message to the device */
mutex_lock(&i2400m->msg_mutex);
spin_lock_irqsave(&i2400m->rx_lock, flags);
i2400m->ack_skb = ERR_PTR(-EINPROGRESS);
spin_unlock_irqrestore(&i2400m->rx_lock, flags);
init_completion(&i2400m->msg_completion);
result = i2400m_tx(i2400m, buf, buf_len, I2400M_PT_CTRL);
if (result < 0) {
dev_err(dev, "can't send message 0x%04x: %d\n",
le16_to_cpu(msg_l3l4_hdr->type), result);
goto error_tx;
}
/* Some commands take longer to execute because of crypto ops,
* so we give them some more leeway on timeout */
switch (msg_type) {
case I2400M_MT_GET_TLS_OPERATION_RESULT:
//.........这里部分代码省略.........
开发者ID:ClarkChen633,项目名称:rtl819x-toolchain,代码行数:101,代码来源:control.c
示例17: file_fn
/***************************************************************************
list info on an open file
***************************************************************************/
static void file_fn(const char * pPath, const char * pUser, uint16 perms,
uint16 locks, uint32 id)
{
d_printf("%-7.1d %-20.20s 0x%-4.2x %-6.1d %s\n",
id, pUser, perms, locks, pPath);
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:9,代码来源:net_rap.c
示例18: torture_domain_close_samr
BOOL torture_domain_close_samr(struct torture_context *torture)
{
BOOL ret = True;
NTSTATUS status;
TALLOC_CTX *mem_ctx = NULL;
struct libnet_context *ctx;
struct lsa_String domain_name;
struct dcerpc_binding *binding;
const char *bindstr;
uint32_t access_mask;
struct policy_handle h;
struct dcerpc_pipe *p;
struct libnet_DomainClose r;
bindstr = torture_setting_string(torture, "binding", NULL);
status = dcerpc_parse_binding(torture, bindstr, &binding);
if (!NT_STATUS_IS_OK(status)) {
d_printf("failed to parse binding string\n");
return False;
}
ctx = libnet_context_init(NULL);
if (ctx == NULL) {
d_printf("failed to create libnet context\n");
ret = False;
goto done;
}
ctx->cred = cmdline_credentials;
mem_ctx = talloc_init("torture_domain_close_samr");
status = dcerpc_pipe_connect(mem_ctx, &p, bindstr, &dcerpc_table_samr,
ctx->cred, NULL);
if (!NT_STATUS_IS_OK(status)) {
d_printf("failed to connect to server %s: %s\n", bindstr,
nt_errstr(status));
ret = False;
goto done;
}
domain_name.string = lp_workgroup();
if (!test_opendomain_samr(p, torture, &h, &domain_name, &access_mask)) {
d_printf("failed to open domain on samr service\n");
ret = False;
goto done;
}
ctx->samr.pipe = p;
ctx->samr.name = domain_name.string;
ctx->samr.access_mask = access_mask;
ctx->samr.handle = h;
/* we have to use pipe's event context, otherwise the call will
hang indefinitely - this wouldn't be the case if pipe was opened
by means of libnet call */
ctx->event_ctx = p->conn->event_ctx;
ZERO_STRUCT(r);
r.in.type = DOMAIN_SAMR;
r.in.domain_name = domain_name.string;
status = libnet_DomainClose(ctx, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
ret = False;
goto done;
}
done:
talloc_free(mem_ctx);
talloc_free(ctx);
return ret;
}
开发者ID:technosaurus,项目名称:samba4-GPL2,代码行数:72,代码来源:libnet_domain.c
示例19: long_group_fn
static void long_group_fn(const char *group_name, const char *comment,
void *state)
{
d_printf("%-21.21s %s\n", group_name, comment);
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:5,代码来源:net_rap.c
示例20: torture_domain_list
BOOL torture_domain_list(struct torture_context *torture)
{
BOOL ret = True;
NTSTATUS status;
TALLOC_CTX *mem_ctx = NULL;
const char *bindstr;
struct dcerpc_binding *binding;
struct libnet_context *ctx;
struct libnet_DomainList r;
int i;
bindstr = torture_setting_string(torture, "binding", NULL);
status = dcerpc_parse_binding(torture, bindstr, &binding);
if (!NT_STATUS_IS_OK(status)) {
d_printf("failed to parse binding string\n");
return False;
}
ctx = libnet_context_init(NULL);
if (ctx == NULL) {
d_printf("failed to create libnet context\n");
ret = False;
goto done;
}
ctx->cred = cmdline_credentials;
mem_ctx = talloc_init("torture_domain_close_samr");
/*
* querying the domain list using default buffer size
*/
ZERO_STRUCT(r);
r.in.hostname = binding->host;
status = libnet_DomainList(ctx, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
ret = False;
goto done;
}
d_printf("Received list or domains (everything in one piece):\n");
for (i = 0; i < r.out.count; i++) {
d_printf("Name[%d]: %s\n", i, r.out.domains[i].name);
}
/*
* querying the domain list using specified (much smaller) buffer size
*/
ctx->samr.buf_size = 32;
ZERO_STRUCT(r);
r.in.hostname = binding->host;
status = libnet_DomainList(ctx, mem_ctx, &r);
if (!NT_STATUS_IS_OK(status)) {
ret = False;
goto done;
}
d_printf("Received list or domains (collected in more than one round):\n");
for (i = 0; i < r.out.count; i++) {
d_printf("Name[%d]: %s\n", i, r.out.domains[i].name);
}
done:
d_printf("\nStatus: %s\n", nt_errstr(status));
talloc_free(mem_ctx);
talloc_free(ctx);
return ret;
}
开发者ID:technosaurus,项目名称:samba4-GPL2,代码行数:76,代码来源:libnet_domain.c
注:本文中的d_printf函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论