php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4088 The funcion yp_next() does not return any value
Submitted: 2000-04-10 03:11 UTC Modified: 2010-12-20 15:23 UTC
From: tex at cselt1 dot polito dot it Assigned: hholzgra (profile)
Status: Closed Package: Unknown/Other Function
PHP Version: 3.0.15 OS: Solaris 7
Private report: No CVE-ID: None
 [2000-04-10 03:11 UTC] tex at cselt1 dot polito dot it
// Found NIS Domain
 $domain = yp_get_default_domain();
 if(!$domain) {
  error("NIS Error","No NIS Domain found");
  exit();
 }

 if ($debug==1) {
  $output .= "NIS Domain: <STRONG>" . $domain . "</STRONG>\n";
  $output .="<BR>\n";
 }

 // Find first entry in NIS passwd table
 $entry = yp_first($domain, "passwd.byname");

 if(!$entry) {
   error("NIS Error","No entry in passewd NIS table");
   exit();
 }

 $key=$entry["key"];
 $value=$entry["value"];
 $output .= "Key: ".$key."<BR>\n";
 $output .= Value: ".$value."<BR>\n";

 $row = yp_next($domain,"passwd.byname","");

 if(!$entry) {
   echo yp_errno() . ": " . yp_err_string();
 }

 $key=$row["key"];
 $value=$row["value"];
 $output .= Key: ".$key."<BR>\n";         // No data return
 $output .= "Value: ".$value."<BR>\n";  // No data return

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-25 08:41 UTC] hholzgra@php.net
Luca Tessitore <tessitore@athena.polito.it> sent in a patch
that seems to fix this, shall we get it into 4.0.2 as a last
minute fix or wait 'til after 4.0.2 release?

(manual will need a fix in yp_first() and yp_next(), too)


==============================================================
RCS file: /repository/php4/ext/yp/yp.c,v
retrieving revision 1.14
diff -u -b -w -B -r1.14 yp.c
--- yp.c        2000/06/05 19:47:45     1.14
+++ yp.c        2000/08/25 12:37:09
@@ -151,7 +151,7 @@
                RETURN_FALSE;
        }
        array_init(return_value);
-       add_assoc_string(return_value,"key",outkey,1);
+       add_assoc_stringl(return_value,"key",outkey,outkeylen,1);
        add_assoc_string(return_value,"value",outval,1);
 }
 /* }}} */
@@ -176,7 +176,8 @@
        }
 
        array_init(return_value);
-       add_assoc_string(return_value,outkey,outval,1);
+       add_assoc_stringl(return_value,"key",outkey,outkeylen,1);
+       add_assoc_string(return_value,"value",outval,1);
 }
 /* }}} */

 [2000-08-27 16:35 UTC] hholzgra@php.net
i consider this as fixed,

but as i am not sure if this breaks current code using
yp_next() i'll check it in immediatly _after_ 4.0.2
release
 [2010-12-20 15:23 UTC] jani@php.net
-Package: NIS related +Package: Unknown/Other Function
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC