On 06/22/2011 03:03 AM, 王道邦 wrote:
> Hi, Mike,
>
> Any update for this? Could you duplicate it now?
>
I have not been able to replicate it. I wanted to confirm you were using
Red Hat Enterprise Linux 5 (RHEL 5), right? You did not mean Red Hat
Linux 5?
Could you try the attached patch? It will not fix the problem. It just
prints out why that getpwuid call failed.
--
You received this message because you are subscribed to the Google Groups
"open-iscsi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/open-iscsi?hl=en.
diff --git a/usr/mgmt_ipc.c b/usr/mgmt_ipc.c
index 3e4d2ef..392484b 100644
--- a/usr/mgmt_ipc.c
+++ b/usr/mgmt_ipc.c
@@ -328,6 +328,8 @@ mgmt_peeruser(int sock, char *user)
socklen_t so_len = sizeof(peercred);
struct passwd *pass;
+ log_error("mgmt_peeruser trying SO_PEERCRED\n");
+
errno = 0;
if (getsockopt(sock, SOL_SOCKET, SO_PEERCRED, &peercred,
&so_len) != 0 || so_len != sizeof(peercred)) {
@@ -338,8 +340,8 @@ mgmt_peeruser(int sock, char *user)
pass = getpwuid(peercred.uid);
if (pass == NULL) {
- log_error("peeruser_unix: unknown local user with uid %d",
- (int) peercred.uid);
+ log_error("peeruser_unix: unknown local user with uid %d err
%d",
+ (int) peercred.uid, errno);
return 0;
}
@@ -352,6 +354,8 @@ mgmt_peeruser(int sock, char *user)
#define cruid cmcred_uid
Cred *cred;
+ log_error("mgmt_peeruser trying cmsgcred\n");
+
/* Compute size without padding */
/* for NetBSD */
char cmsgmem[_ALIGN(sizeof(struct cmsghdr)) + _ALIGN(sizeof(Cred))];
@@ -388,8 +392,8 @@ mgmt_peeruser(int sock, char *user)
pw = getpwuid(cred->cruid);
if (pw == NULL) {
- log_error("ident_unix: unknown local user with uid %d",
- (int) cred->cruid);
+ log_error("ident_unix: unknown local user with uid %d err %d",
+ (int) cred->cruid, errno);
return 0;
}
diff --git a/utils/fwparam_ibft/fwparam_ibft_sysfs.c
b/utils/fwparam_ibft/fwparam_ibft_sysfs.c
index 9185c85..486deec 100644
--- a/utils/fwparam_ibft/fwparam_ibft_sysfs.c
+++ b/utils/fwparam_ibft/fwparam_ibft_sysfs.c
@@ -84,7 +84,7 @@ static int find_sysfs_dirs(const char *fpath, const struct
stat *sb,
static int get_iface_from_device(char *id, struct boot_context *context)
{
char dev_dir[FILENAMESZ];
- int rc = ENODEV;
+ int rc = EOPNOTSUPP;
DIR *dirfd;
struct dirent *dent;
@@ -99,8 +99,7 @@ static int get_iface_from_device(char *id, struct
boot_context *context)
return errno;
while ((dent = readdir(dirfd))) {
- if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..") ||
- strncmp(dent->d_name, "net:", 4))
+ if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
continue;
if (!strncmp(dent->d_name, "net:", 4)) {
@@ -116,17 +115,19 @@ static int get_iface_from_device(char *id, struct
boot_context *context)
rc = EINVAL;
rc = 0;
break;
- } else {
- printf("Could not read ethernet to net link.\n");
- rc = EOPNOTSUPP;
+ }
+ if (!strcmp(dent->d_name, "net")) {
+ rc = ENODEV;
break;
}
}
closedir(dirfd);
- if (rc != ENODEV)
+ if (rc != ENODEV) {
+ printf("Could not read ethernet to net link\n.");
return rc;
+ }
/* If not found try again with newer kernel networkdev sysfs layout */
strlcat(dev_dir, "/net", FILENAMESZ);
diff --git a/utils/fwparam_ibft/prom_lex.c b/utils/fwparam_ibft/prom_lex.c
index 704d8ca..5fdd95b 100644
--- a/utils/fwparam_ibft/prom_lex.c
+++ b/utils/fwparam_ibft/prom_lex.c
@@ -8,7 +8,7 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 33
+#define YY_FLEX_SUBMINOR_VERSION 35
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
@@ -30,7 +30,7 @@
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
-#if __STDC_VERSION__ >= 199901L
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
* if you want the limit (max/min) macros for int types.
@@ -93,11 +93,12 @@ typedef unsigned int flex_uint32_t;
#else /* ! __cplusplus */
-#if __STDC__
+/* C99 requires __STDC__ to be defined as 1. */
+#if defined (__STDC__)
#define YY_USE_CONST
-#endif /* __STDC__ */
+#endif /* defined (__STDC__) */
#endif /* ! __cplusplus */
#ifdef YY_USE_CONST
@@ -177,14 +178,9 @@ extern FILE *yyin, *yyout;
#define unput(c) yyunput( c, (yytext_ptr) )
-/* The following is because we cannot portably get our hands on size_t
- * (without autoconf's help, which isn't available because we want
- * flex-generated scanners to compile on their own).
- */
-
#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
-typedef unsigned int yy_size_t;
+typedef size_t yy_size_t;
#endif
#ifndef YY_STRUCT_YY_BUFFER_STATE
@@ -920,7 +916,7 @@ int yy_flex_debug = 0;
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
#ifndef YYLMAX
-#define YYLMAX 2048
+#define YYLMAX 8192
#endif
char yytext[YYLMAX];
@@ -965,7 +961,7 @@ char *yytext_ptr;
void dbgprint(const char *item) { fprintf(stderr, "%s: \"%s\" len=%d ", item,
yytext, yyleng);}
/* CHOSEN uses only boot related paths. */
-#line 969 "<stdout>"
+#line 965 "<stdout>"
#define INITIAL 0
@@ -983,6 +979,35 @@ void dbgprint(const char *item) { fprintf(stderr, "%s:
\"%s\" len=%d ", item, yy
static int yy_init_globals (void );
+/* Accessor methods to globals.
+ These are made visible to non-reentrant scanners for convenience. */
+
+int yylex_destroy (void );
+
+int yyget_debug (void );
+
+void yyset_debug (int debug_flag );
+
+YY_EXTRA_TYPE yyget_extra (void );
+
+void yyset_extra (YY_EXTRA_TYPE user_defined );
+
+FILE *yyget_in (void );
+
+void yyset_in (FILE * in_str );
+
+FILE *yyget_out (void );
+
+void yyset_out (FILE * out_str );
+
+int yyget_leng (void );
+
+char *yyget_text (void );
+
+int yyget_lineno (void );
+
+void yyset_lineno (int line_number );
+
/* Macros after this point can all be overridden by user definitions in
* section 1.
*/
@@ -1025,7 +1050,7 @@ static int input (void );
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
-#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
@@ -1036,7 +1061,7 @@ static int input (void );
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
- size_t n; \
+ unsigned n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
@@ -1121,7 +1146,7 @@ YY_DECL
#line 63 "prom_lex.l"
-#line 1125 "<stdout>"
+#line 1150 "<stdout>"
if ( !(yy_init) )
{
@@ -1298,7 +1323,7 @@ YY_RULE_SETUP
#line 91 "prom_lex.l"
ECHO;
YY_BREAK
-#line 1302 "<stdout>"
+#line 1327 "<stdout>"
case YY_END_OF_BUFFER:
{
@@ -1528,7 +1553,7 @@ static int yy_get_next_buffer (void)
/* Read in more data. */
YY_INPUT(
(&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
- (yy_n_chars), num_to_read );
+ (yy_n_chars), (size_t) num_to_read );
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
}
@@ -1552,6 +1577,14 @@ static int yy_get_next_buffer (void)
else
ret_val = EOB_ACT_CONTINUE_SCAN;
+ if ((yy_size_t) ((yy_n_chars) + number_to_move) >
YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+ /* Extend the array by 50%, plus the number we really need. */
+ yy_size_t new_size = (yy_n_chars) + number_to_move +
((yy_n_chars) >> 1);
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void
*) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
+ if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in
yy_get_next_buffer()" );
+ }
+
(yy_n_chars) += number_to_move;
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] =
YY_END_OF_BUFFER_CHAR;
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] =
YY_END_OF_BUFFER_CHAR;
@@ -1963,7 +1996,9 @@ static void yyensure_buffer_stack (void)
(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
(num_to_alloc *
sizeof(struct yy_buffer_state*)
);
-
+ if ( ! (yy_buffer_stack) )
+ YY_FATAL_ERROR( "out of dynamic memory in
yyensure_buffer_stack()" );
+
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct
yy_buffer_state*));
(yy_buffer_stack_max) = num_to_alloc;
@@ -1981,6 +2016,8 @@ static void yyensure_buffer_stack (void)
((yy_buffer_stack),
num_to_alloc *
sizeof(struct yy_buffer_state*)
);
+ if ( ! (yy_buffer_stack) )
+ YY_FATAL_ERROR( "out of dynamic memory in
yyensure_buffer_stack()" );
/* zero only the new slots.*/
memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size
* sizeof(struct yy_buffer_state*));
@@ -2025,7 +2062,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t
size )
/** Setup the input buffer state to scan a string. The next call to yylex()
will
* scan from a @e copy of @a str.
- * @param str a NUL-terminated string to scan
+ * @param yystr a NUL-terminated string to scan
*
* @return the newly allocated buffer state object.
* @note If you want to scan bytes that may contain NUL values, then use