PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Text » Text_Wiki » Bug #7451

Segmentation fault (11) in Apache Log if the Text_wiki interprets Text

Details

Submitted2006-04-21 10:08 UTC
Frombugs at administrator dot de
StatusNo Feedback
PackageText_Wiki
PHP Version5.1.2
OSDebian Linux 2.6.12-1-k7 Kernel
Roadmaps(Not assigned)

Comments

[2006-04-21 10:08 UTC] bugs at administrator dot de

Description:
------------
The follow code generate a "Segmentation fault (11)" im my Apache. My Config is: Apache/2.2.0 (Unix) mod_ssl/2.2.0 OpenSSL/0.9.8a PHP/5.1.2, MySQl 5.0.16

The error is only if the Text use the "<code>" Command.

If i delete the Line 6: 'objExcel.ActiveSheet.Cells(x, 9).Value = "Ja"' than it works fine, with line 6 a download request open in the Browser with a Segmentation fault in my Log.

Here now the Text: (without SNIPP ---)

SNIPP --------------------------------------------
Hi,
kein Problem:

<code>

objExcel.ActiveSheet.Cells(x, 9).Value = "Ja"

On Error Resume Next

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True
objExcel.Workbooks.Add

'Set objWorkbook = objExcel.Workbooks.Add
Set objWorksheet = objWorkbook.Worksheets(3)
Set colSheets = objWorkbook.Sheets

'#######################################
' Auslesen der Textdatei - Darin stehen die OU Gruppen
'#######################################
Dim arrFileLines()
i = 0
Set objFile = objFSO.OpenTextFile("ou.txt", 1)

Do Until objFile.AtEndOfStream
Redim Preserve arrFileLines(i)
arrFileLines(i) = objFile.ReadLine
i = i + 1
Loop
objFile.Close

'#######################################
'#######################################
'colSheets.add ,objWorksheet,b
x = 2
oucount = 1
mustchangepw = 1
ischangedpw = 1

For l = Ubound(arrFileLines) to LBound(arrFileLines) Step -1

'x = 3

Set objWorksheet = objWorkbook.Worksheets(1)
objWorksheet.Activate

'#############################################################
'Erstelllt die Überschriften in der Exceldatei
'#############################################################
objExcel.ActiveSheet.Cells(1, 1).Value = "Name"
objExcel.ActiveSheet.Cells(1, 2).Value = "Benutzername"
objExcel.ActiveSheet.Cells(1, 3).Value = "Letze PW-Änderung"
objExcel.ActiveSheet.Cells(1, 4).Value = "Organisationeinheiten"
objExcel.ActiveSheet.Cells(1, 5).Value = "Passwortalter"
objExcel.ActiveSheet.Cells(1, 6).Value = "Pw Info "
objExcel.ActiveSheet.Cells(1, 7).Value = "PW soll ablaufen"
objExcel.ActiveSheet.Cells(1, 8).Value = "Letzter Login"
objExcel.ActiveSheet.Cells(1, 9).Value = "Zugang deaktiviert"

'#############################################################
'Passt die Spaltenbreite der jeweiligen Überschrift an
'#############################################################
objExcel.ActiveSheet.Cells(1, 1).ColumnWidth = 16
objExcel.ActiveSheet.Cells(1, 2).ColumnWidth = 20
objExcel.ActiveSheet.Cells(1, 3).ColumnWidth = 18
objExcel.ActiveSheet.Cells(1, 4).ColumnWidth = 41
objExcel.ActiveSheet.Cells(1, 5).ColumnWidth = 15
objExcel.ActiveSheet.Cells(1, 6).ColumnWidth = 13
objExcel.ActiveSheet.Cells(1, 7).ColumnWidth = 14
objExcel.ActiveSheet.Cells(1, 8).ColumnWidth = 12
objExcel.ActiveSheet.Cells(1, 9).ColumnWidth = 17

'#############################################################
'Dekl. von Konstanten
'#############################################################
Const ADS_UF_ACCOUNTDISABLE = 2
Const ADS_UF_PASSWORD_EXPIRED = &h800000
Const ADS_ACETYPE_ACCESS_DENIED_OBJECT = &H6
Const CHANGE_PASSWORD_GUID = "{ab721a53-1e2f-11d0-9819-00aa0040529b}"

Set objHash = CreateObject("Scripting.Dictionary")
objHash.Add "ADS_UF_DONT_EXPIRE_PASSWD", &h10000

Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection

objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE

'#############################################################
'Dekl. für das schreiben der Textdatei
'#############################################################
Dim fso
Dim TF

Set fso = CreateObject("Scripting.FileSystemObject")
Set TF = FSO.OpenTextFile("C:\Dokumente und Einstellungen\Daniel\Desktop\pw\benutzer.txt",8, True)

objCommand.CommandText = _
"<GC://" & arrFileLines(l) & ">;(objectCategory=User)" & _
";userAccountControl,distinguishedName,cn;subtree"

Set objRecordSet = objCommand.Execute
Do Until objRecordset.EOF
intUserAccountControl = objRecordset.Fields("userAccountControl")
If NOT intUserAccountControl AND ADS_UF_ACCOUNTDISABLE Then
For Each Key In objHash.Keys

'#############################################################
'Auslesen der Infos und erzeugen des Excelinhalts
'#############################################################

set objuser = getObject ("LDAP://" & objRecordset.Fields("distinguishedName").value)

lastlogon = objuser.LastLogin
dtmValue = objuser.PasswordLastChanged
'cnName = objuser.cn
dnName = objRecordset.Fields("distinguishedName").value

dnnamesumcount = Len(dnname)
dnnamecount = InStr(1,dnname,"OU")
cut = dnnamesumcount - dnnamecount
dncut = Right(dnname, cut)
'wscript.echo dncut

TF.WriteLine("WYDLER\" + objuser.sAMAccountName)
objExcel.ActiveSheet.Cells(x, 1).Value = objuser.cn 'cnName
objExcel.ActiveSheet.Cells(x, 2).Value = objuser.sAMAccountName
objExcel.ActiveSheet.Cells(x, 3).Value = objuser.PasswordLastChanged 'Left(dtmValue,10)

datepw = Left(dtmValue,10)
today = Now
today1 = "05.04.2006"
days = DateDiff ("d", datepw, today)

If objHash(Key) And intUserAccountControl Then
objExcel.ActiveSheet.Cells(x, 6).Value = "PW läuft nie ab"
objExcel.Cells(x, 6).Interior.ColorIndex = 4

else
objExcel.ActiveSheet.Cells(x, 6).Value = "PW läuft ab"
objExcel.Cells(x, 6).Interior.ColorIndex = 3
End if

If days > 90 Then
'objExcel.Cells(x, 1).Interior.ColorIndex = 3
'objExcel.Cells(x, 2).Interior.ColorIndex = 3
'objExcel.Cells(x, 3).Interior.ColorIndex = 3
objExcel.Cells(x, 5).Interior.ColorIndex = 3
mustchangepw = mustchangepw + 1

Else
'objExcel.Cells(x, 1).Interior.ColorIndex = 4
'objExcel.Cells(x, 2).Interior.ColorIndex = 4
'objExcel.Cells(x, 3).Interior.ColorIndex = 4
objExcel.Cells(x, 5).Interior.ColorIndex = 4
'objExcel.ActiveSheet.Cells(x, 5).Value = 0
ischangedpw = ischangedpw + 1
End if

'objExcel.ActiveSheet.Cells(x, 3).Value = dncut
objExcel.ActiveSheet.Cells(x, 4).Value = dncut 'arrFileLines(l)
objExcel.ActiveSheet.Cells(x, 5).Value = days
objExcel.ActiveSheet.Cells(x, 7).Value = "Nein"
objExcel.ActiveSheet.Cells(x, 8).Value = Left(lastlogon,10)

If intUserAccountControl AND ADS_UF_ACCOUNTDISABLE Then
</code>
objExcel.ActiveSheet.Cells(x, 9).Value = "Ja"

Else
objExcel.ActiveSheet.Cells(x, 9).Value = "Nein"

End If

x = x + 1

Next
End If
objRecordset.MoveNext

Loop

objConnection.Close
TF.Close

oucount = oucount + 1

Next
Set objRange = objWorksheet.UsedRange
'ActiveWorkbook.SaveAs Filename:="C:\Test.txt", FileFormat:=xlCSV)

objRange.EntireColumn.Autofit()
objExcel.Close
wscript.echo "Fertig!"

Hoffe es ist genug!! :-)

Gruß
Dani

SNIPP --------------------------------------------

Thanks
Frank Scholl
administrator.de Germany

Test script:
---------------
"$text" get data from Mysql.

include_once 'Text/Wiki.php';
$wiki =& new Text_Wiki();
$text = $wiki->transform($text);
echo $text;

Actual result:
--------------
im my apache Log:

[Fri Apr 21 11:52:34 2006] [notice] child pid 29487 exit signal Segmentation fault (11)
[Fri Apr 21 11:57:51 2006] [notice] child pid 29554 exit signal Segmentation fault (11)

...