ARS_CreateEntry problem
Brought to you by:
jeffmurphy
|
From: <as...@co...> - 1996-06-06 04:59:01
|
Hi! My collegue using ARSperl had this problem. Is this problem related to the bug fixed that was reported about the malloc problem some time earlier. We are working with the package after this bug was fixed. Any help?!! Thanks Ashfaq >From own...@lu... Fri May 3 19:30:01 1996 >Subject: bug fix >To: ar...@lu... >X-Mailer: ELM [version 2.4 PL23] >Mime-Version: 1.0 >Content-Type: text/plain; charset=US-ASCII >Content-Transfer-Encoding: 7bit >Sender: own...@lu... >Precedence: bulk >Reply-To: ar...@lu... >Content-Length: 354 >X-Lines: 11 >Status: RO > >another malloc problem fixed... >.. >At the bottom of ars_CreateEntry I had a FreeARValueList, which I changed >to a plain free. The problem was FreeARValueList would deallocate strings >in the list and destroy the functions argument list. > >the fixed version is at: >ftp://smurfland.cit.buffalo.edu/ftp/pub/utils/Perl/ARSperl.tgz ----- Begin Included Message ----- ARS_CreateEntry When I run this script, I get bad free() at line XX messages. Some entries are added correctly. Some are added with improper values in the fields (i.e. middle initial in the "phone" field). Maybe something wrong with varargs support? #!/usr/local/bin/perl use ARS; while (<>) { chop; push (@entries,$_); } $SCHEMA = "AR-End User Information"; # Parse command line parameters ($server, $username, $password) = @ARGV; if(!defined($password)) { print "usage: $0 [server] [username] [password]\n"; exit 1; } # Log onto the ars server specified print "logging into server\n"; ($ctrl = ars_Login($server, $username, $password)) || die "can't login to the server"; $type_fid = ars_GetFieldByName($ctrl, $SCHEMA, "Employee Type") || die "error"; $stat_fid = ars_GetFieldByName($ctrl, $SCHEMA, "Status") || die "error"; $first_fid = ars_GetFieldByName($ctrl, $SCHEMA, "First Name") || die "error"; $mid_fid = ars_GetFieldByName($ctrl, $SCHEMA, "Middle Initial") || die "error"; $last_fid = ars_GetFieldByName($ctrl, $SCHEMA, "Last Name") || die "error"; $nick_fid = ars_GetFieldByName($ctrl, $SCHEMA, "Nickname") || die "error"; $emp_fid = ars_GetFieldByName($ctrl, $SCHEMA, "Emp No") || die "error"; $dept_fid = ars_GetFieldByName($ctrl, $SCHEMA, "Dept No") || die "error"; $dom_fid = ars_GetFieldByName($ctrl, $SCHEMA, "HR Domain") || die "error"; $loc_fid = ars_GetFieldByName($ctrl, $SCHEMA, "Location") || die "error"; $phone_fid = ars_GetFieldByName($ctrl, $SCHEMA, "Phone") || die "error"; # input is of form: # type:status:first:mid:last:nick:empid:dept:domain:loc # foreach $i (@entries) { @F = split(/:/,$i); $remid = ars_CreateEntry ($ctrl,$SCHEMA, $type_fid, $F[0], $stat_fid, $F[1], $first_fid, $F[2], $mid_fid, $F[3], $last_fid, $F[4], $nick_fid, $F[5], $emp_fid, $F[6], $dept_fid, $F[7], $dom_fid, $F[8], $loc_fid, $F[9], $phone_fid, "NONE"); if ($remid) { print "added Employee entry $remid\n"; } else { print "Error $ars_errstr\n adding $i\n"; last; } }; # Log out of the server. ars_Logoff($ctrl); ----- End Included Message ----- |